.expert-page {
  display: grid;
  gap: 12px;
}

.expert-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 0 1px;
}

.expert-page-head h1 {
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.expert-page-head p {
  max-width: 720px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.expert-primary,
.expert-secondary,
.expert-icon-button,
.expert-tab,
.expert-card-action {
  min-height: 38px;
  border-radius: var(--radius);
  cursor: pointer;
}

.expert-primary {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  padding: 0 16px;
  font-weight: 700;
}

.expert-primary:hover { background: var(--blue-strong); }
.expert-primary:focus-visible,
.expert-secondary:focus-visible,
.expert-icon-button:focus-visible,
.expert-tab:focus-visible,
.expert-card-main:focus-visible,
.expert-card-action:focus-visible,
.expert-search input:focus-visible,
.expert-filter-tools select:focus-visible,
.expert-chat-form textarea:focus-visible,
.expert-chat-form select:focus-visible,
.expert-output-option:has(input:focus-visible) {
  outline: 3px solid var(--focus-ring, #ffd54a);
  outline-offset: 2px;
  box-shadow: 0 0 0 1px var(--focus-edge, #6b4f00);
}
.expert-primary i,
.expert-primary svg { width: 17px; height: 17px; }

.expert-note {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #cbdaf0;
  border-radius: var(--radius);
  background: #f7faff;
  color: var(--muted-strong);
  padding: 10px 12px;
  font-size: 13px;
}

.expert-note i,
.expert-note svg { width: 16px; height: 16px; color: var(--blue); }

.expert-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 12px;
}

.expert-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.expert-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 0 10px;
  color: var(--muted-strong);
  font-weight: 600;
}

.expert-tab[aria-selected="true"] {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

.expert-tab-count {
  margin-left: 4px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.expert-filter-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.expert-search {
  position: relative;
  display: block;
  width: min(300px, 28vw);
  height: 38px;
}

.expert-search i,
.expert-search > svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.expert-search input,
.expert-filter-tools select,
.expert-chat-form textarea,
.expert-chat-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}

.expert-search input {
  display: block;
  height: 38px;
  padding: 0 12px 0 36px;
}

.expert-filter-tools select {
  width: auto;
  min-width: 132px;
  height: 38px;
  padding: 0 30px 0 10px;
}

.expert-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.expert-result-meta strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

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

.expert-skill-card {
  position: relative;
  min-width: 0;
  min-height: 208px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.expert-skill-card:hover { border-color: #9fb7d6; }
.expert-skill-card.is-installed { border-color: #9bb9e8; }

.expert-card-main {
  display: block;
  width: 100%;
  min-height: 158px;
  border: 0;
  background: transparent;
  padding: 16px 82px 11px 16px;
  text-align: left;
  cursor: pointer;
}

.expert-card-main:hover .expert-card-title { color: var(--blue); }

.expert-card-action {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  width: auto;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 9px;
  font-size: 13px;
  font-weight: 650;
}

.expert-card-action:hover { border-color: var(--blue); color: var(--blue); }
.expert-card-action.is-installed { border-color: #bad2f5; background: var(--blue-soft); color: var(--blue); }
.expert-card-action i,
.expert-card-action svg { width: 17px; height: 17px; }

.expert-card-topline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.expert-skill-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #c9d8ec;
  border-radius: 5px;
  background: #f8fbff;
  color: var(--navy);
}

.expert-skill-icon i,
.expert-skill-icon svg { width: 21px; height: 21px; }

.expert-card-heading { min-width: 0; }
.expert-card-title {
  display: block;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expert-card-level {
  display: inline-block;
  margin-top: 2px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.expert-card-description {
  display: -webkit-box;
  overflow: hidden;
  min-height: 42px;
  margin-top: 13px;
  color: var(--muted-strong);
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.expert-card-use {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.expert-card-use i,
.expert-card-use svg { width: 15px; height: 15px; }

.expert-card-footer {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  padding: 10px 16px;
  font-size: 13px;
}

.expert-card-footer span:last-child { white-space: nowrap; }
.expert-card-footer strong { color: var(--muted-strong); font-weight: 600; }

.expert-empty {
  display: grid;
  min-height: 300px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.expert-empty i,
.expert-empty svg { width: 28px; height: 28px; margin-bottom: 8px; }

.main.has-expert-modal { overflow: hidden; }

.expert-modal-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  background: rgba(7, 27, 52, .42);
}

.expert-modal {
  position: fixed;
  z-index: 61;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(680px, calc(100vw - 48px));
  max-height: min(760px, calc(100vh - 48px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  transform: translate(-50%, -50%);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 20px 52px rgba(7, 27, 52, .24);
}

.expert-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px 15px;
}

.expert-modal-head h2 { font-size: 20px; line-height: 1.35; }
.expert-modal-head p { margin-top: 4px; color: var(--muted); font-size: 13px; }

.expert-icon-button {
  display: grid;
  width: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
}

.expert-icon-button:hover { border-color: var(--blue); color: var(--blue); }
.expert-icon-button i,
.expert-icon-button svg { width: 18px; height: 18px; }

.expert-modal-body {
  overflow: auto;
  padding: 20px;
}

.expert-modal-section + .expert-modal-section { margin-top: 22px; }
.expert-modal-section h3 { margin-bottom: 9px; font-size: 15px; }
.expert-modal-section p { color: var(--muted-strong); }

.expert-detail-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.expert-detail-list li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  color: var(--muted-strong);
}

.expert-detail-list i,
.expert-detail-list svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 3px; color: var(--blue); }

.expert-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 13px 20px;
}

.expert-secondary {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  font-weight: 600;
}

.expert-secondary:hover { border-color: var(--blue); color: var(--blue); }

.expert-chat-form {
  display: grid;
  gap: 16px;
}

.expert-field { display: grid; gap: 6px; }
.expert-field label { color: var(--text); font-size: 13px; font-weight: 700; }
.expert-field small { color: var(--muted); font-size: 13px; }
.expert-chat-form fieldset.expert-field { margin: 0; border: 0; padding: 0; }
.expert-chat-form legend { margin-bottom: 6px; color: var(--text); font-size: 13px; font-weight: 700; }
.expert-chat-form select { height: 40px; padding: 0 10px; }
.expert-chat-form textarea { min-height: 132px; resize: vertical; padding: 10px 12px; }

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

.expert-output-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  color: var(--muted-strong);
}

.expert-page-footnote {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 1100px) {
  .expert-skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expert-toolbar { align-items: stretch; flex-direction: column; }
  .expert-filter-tools { justify-content: space-between; }
  .expert-search { width: 100%; }
}

@media (max-width: 760px) {
  .expert-page-head { align-items: stretch; flex-direction: column; }
  .expert-primary { width: 100%; }
  .expert-tabs { overflow-x: auto; }
  .expert-filter-tools { align-items: stretch; flex-direction: column; }
  .expert-filter-tools select { width: 100%; }
  .expert-skill-grid { grid-template-columns: 1fr; }
  .expert-modal { width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  .expert-skill-card,
  .expert-card-title { transition: none; }
}
