:root {
  color-scheme: light;
  --bg: #f3f7fd;
  --surface: #ffffff;
  --surface-muted: #eaf2ff;
  --text: #122033;
  --muted: #607089;
  --line: #d7e2f1;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --navy: #0f1f3a;
  --blue: #2b5fb8;
  --amber: #a16207;
  --red: #b4233a;
  --shadow: 0 18px 45px rgba(18, 32, 51, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

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

.sidebar {
  background: #0f1f3a;
  color: #f7fafc;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: #2563eb;
  border-radius: 6px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -2.4px;
  line-height: 1;
  padding: 0 2px 0 1px;
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: #bfd0e8;
  font-size: 12px;
}

.section-nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  border: 0;
  color: #e1ebf8;
  background: transparent;
  padding: 11px 12px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-count {
  color: #bfd0e8;
  font-size: 12px;
}

.sidebar-footer {
  margin-top: auto;
  color: #bfd0e8;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #60a5fa;
}

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

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 28px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

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

.search-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.search-panel label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.search-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  outline: none;
}

.search-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.catalog-area {
  display: grid;
  gap: 22px;
  margin-top: 28px;
}

.catalog-section {
  display: grid;
  gap: 12px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.section-heading h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

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

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

.resource-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.resource-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 100px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(18, 32, 51, 0.05);
}

.resource-card-link:hover .resource-card,
.resource-card-link:focus-visible .resource-card {
  border-color: rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
  transition: 160ms ease;
}

.resource-card:hover {
  border-color: rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
  transition: 160ms ease;
}

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

.resource-card h3 {
  margin-bottom: 7px;
  font-size: 17px;
}

.resource-card p {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0;
  font-size: 14px;
}

.type-pill {
  align-self: start;
  color: #ffffff;
  background: var(--blue);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.type-h5 { background: var(--accent); }
.type-client { background: var(--amber); }
.type-tool { background: var(--blue); }
.type-website { background: var(--red); }

.status-text {
  color: var(--muted);
  font-size: 12px;
}

.assistant-widget {
  position: fixed;
  right: 24px;
  top: 50%;
  z-index: 40;
  transform: translateY(-50%);
  display: grid;
  justify-items: end;
  gap: 14px;
  pointer-events: none;
}

.assistant-fab,
.assistant-panel {
  pointer-events: auto;
}

.assistant-fab {
  min-width: 92px;
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.28);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.assistant-fab:hover {
  background: var(--accent-strong);
}

.assistant-fab:focus-visible,
.assistant-close:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 3px;
}

.assistant-fab-mark {
  display: block;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

.assistant-panel {
  width: min(420px, calc(100vw - 40px));
  max-height: min(720px, calc(100vh - 48px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transform: translateX(18px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.assistant-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.assistant-header {
  padding: 18px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}

.assistant-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.assistant-header h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.assistant-header p {
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.5;
  font-size: 13px;
}

.assistant-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.assistant-close:hover {
  color: var(--text);
  border-color: #b8c4d0;
}

.assistant-frame {
  height: min(620px, calc(100vh - 170px));
  min-height: 420px;
  background: #f8fbff;
}

.assistant-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.assistant-placeholder {
  min-height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.assistant-placeholder strong {
  color: var(--text);
  font-size: 18px;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .item-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 14px 16px 12px;
    gap: 12px;
  }

  .brand-block {
    gap: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 15px;
    letter-spacing: -2px;
    border-radius: 6px;
  }

  .brand-name {
    font-size: 18px;
    line-height: 1.2;
  }

  .brand-subtitle {
    margin-top: 1px;
    font-size: 11px;
  }

  .section-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-button {
    min-height: 38px;
    padding: 6px 8px;
    border-radius: 6px;
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    line-height: 1.2;
  }

  .nav-count {
    font-size: 11px;
  }

  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 22px;
  }

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

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

  .assistant-widget {
    right: 16px;
  }

  .assistant-fab {
    min-width: 84px;
    height: 44px;
  }

  .assistant-panel {
    width: calc(100vw - 32px);
  }

  .assistant-frame {
    height: min(560px, calc(100vh - 156px));
    min-height: 360px;
  }
}
