.catalog-panel { max-width: var(--page-width); }
.library-tabs { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-block: 0 22px; border-bottom: 1px solid var(--line); }
.library-tab-group { display: flex; gap: 5px; }
.library-tab-actions { margin-inline-start: auto; }
.library-tabs a { display: grid; place-items: center; min-height: 40px; padding: 6px 12px; border-bottom: 2px solid transparent; color: var(--muted); white-space: nowrap; }
.library-tabs a:hover { color: var(--gold-dark); background: var(--surface-hover); }
.library-tabs a[aria-current="page"] { border-bottom-color: var(--gold); color: var(--gold-dark); font-weight: 600; }
.catalog-kicker { color: var(--gold); font-size: 13px; margin-bottom: 6px; }
.catalog-filters, .catalog-search {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px 16px;
  width: min(100%, 620px);
  margin: 20px 0;
}
.catalog-filters select, .catalog-panel input[type="search"] {
  width: 100%;
  min-width: 0;
}
.catalog-filters button, .catalog-search button { grid-column: 2; justify-self: start; }
.catalog-status { margin: 13px 0 11px; font-size: 13px; }
.catalog-links, .popover-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 15px; }
.page-heading .catalog-links { margin-top: 11px; }
.catalog-links a, .popover-links a, .catalog-scope a, .capability-dependencies a { color: var(--gold-dark); text-decoration: underline; text-underline-offset: .18em; }
.catalog-links a, .popover-links a { font-size: 13px; }
.catalog-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 15px;
  padding: 9px 12px;
  border-left: 2px solid var(--gold-line);
  background: var(--gold-soft);
  font-size: 13px;
}
.capability-dependencies { width: 100%; margin: 0; padding-top: 9px; border-top: 1px solid var(--line); font-size: 13px; }
.capability-dependencies dt { font-weight: 600; }
.capability-dependencies dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 2px 0 8px; color: var(--muted); overflow-wrap: anywhere; }
.capability-dependencies dd:last-child { margin-bottom: 0; }
.directory-head { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 13px; }
.directory-head h1 { font-family: var(--serif); }
.directory-head p { margin-top: 9px; line-height: 1.65; }
.directory-filters { display: flex; flex-wrap: wrap; width: min(100%, 650px); margin: 2px 0 0; gap: 8px; }
.directory-filters select { width: auto; flex: 0 1 172px; }
.directory-filters input { width: auto; flex: 1 1 210px; }
.directory-filters button { min-height: 42px; }
.workbench-search { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.workbench-search button { grid-column: auto; justify-self: stretch; }
.search-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
.search-shortcuts a { display: inline-flex; align-items: center; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.expert-region + .expert-region { margin-top: 30px; }
.expert-region-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--gold-line); }
.expert-region-heading h2 { margin: 0; font: 500 21px/1.45 var(--serif); }
.expert-region-heading .subtle { font-size: 13px; }
.expert-country { margin-top: 19px; }
.expert-country > h3 { margin: 0 0 9px; color: var(--muted); font-size: 14px; font-weight: 650; }
.expert-country .catalog-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.catalog-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--surface-radius);
  background: var(--paper);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.catalog-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 10px; color: var(--gold-dark); background: var(--gold-soft); font-size: 17px; }
.catalog-card :is(h2, h3, h4) { margin: 0; font: 600 17px/1.45 var(--sans); }
.expert-card { min-height: 258px; padding: 20px 22px; gap: 14px; }
.expert-card-header { display: flex; align-items: flex-start; gap: 14px; width: 100%; }
.expert-card-copy { min-width: 0; }
.expert-card-copy :is(h3, h4) { font-family: inherit; font-size: 16px; font-weight: 650; }
.expert-card-copy .catalog-role { margin: 4px 0 6px; color: var(--muted); font-size: 14px; font-weight: 400; }
.expert-card-copy .catalog-card-meta { align-items: center; justify-content: flex-start; gap: 6px; }
.expert-card-copy .catalog-card-meta > span:first-child { padding: 2px 7px; border-radius: 5px; color: var(--gold-dark); background: var(--gold-soft); }
.expert-portrait { display: block; flex: none; width: 66px; height: 66px; border-radius: 14px; background: var(--sidebar) url('/assets/expert-chief.png') no-repeat; background-size: 400% 300%; }
.expert-portrait[data-kind="specialist"] { background-image: url('/assets/expert-specialist.png'); }
.expert-card > .outline { width: 100%; color: var(--gold-dark); border-color: var(--gold-line); }
.catalog-card-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; width: 100%; color: var(--muted); font-size: 13px; }
.catalog-badge, .capability-tags > span { padding: 2px 8px; border-radius: 5px; color: var(--muted); background: var(--sidebar); font-size: 13px; }
.catalog-badge.is-available { color: var(--positive); background: var(--positive-soft); }
.catalog-role { font-weight: 600; }
.catalog-delivery { width: 100%; margin: 1px 0 0; padding-top: 9px; border-top: 1px solid var(--line); font-size: 13px; }
.catalog-delivery dt { font-weight: 600; }
.catalog-delivery dd { margin: 2px 0 8px; color: var(--muted); }
.catalog-card button { margin-top: auto; }
.capability-tags { display: flex; flex-wrap: wrap; gap: 5px; }
#task-binding { margin: 10px 0 13px; }
#search-results > h2 { margin-top: 26px; font: 600 21px/1.4 var(--serif); }
#search-results > .history-list { margin-top: 0; }
.choice-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 37px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
}
.choice-control:hover { color: var(--gold-dark); background: var(--sidebar); }
.choice-control .ui-icon { width: 17px; height: 17px; flex: none; }
.icon-choice { justify-content: center; min-width: 36px; }
.icon-choice .ui-icon { width: 19px; height: 19px; }
.composer-label { min-width: 0; max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#choose-expert .composer-label { max-width: min(230px, 38vw); }
#choose-workspace .composer-label { max-width: min(260px, 66vw); }
.expert-trigger-avatar { display: grid; flex: none; place-items: center; width: 24px; height: 24px; }
.expert-trigger-avatar .expert-portrait { width: 24px; height: 24px; border-radius: 50%; }
.composer-menu { position: relative; min-width: 0; max-width: 100%; }
.composer-menu > summary { cursor: pointer; list-style: none; overflow-wrap: anywhere; }
.composer-menu > summary::-webkit-details-marker { display: none; }
#choose-skill:has(.composer-label:not([hidden])) { color: var(--gold-dark); }
.composer-menu[open] > summary { border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold-dark); }
.composer-popover {
  position: absolute;
  z-index: 4;
  inset: auto auto calc(100% + 8px) 0;
  display: grid;
  gap: 8px;
  width: min(330px, calc(100vw - 36px));
  padding: 10px;
  border: 1px solid var(--field-line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 12px 32px rgb(25 36 54 / 14%);
}
.composer-popover input { width: 100%; font-size: 13px; }
.composer-reference-anchor { position: relative; margin-inline: 14px; }
.composer-reference-anchor .composer-reference-menu {
  position: absolute;
  z-index: 7;
  inset: 6px auto auto 0;
  width: min(100%, 450px);
  max-height: min(360px, 55dvh);
  overflow-y: auto;
}
.composer-reference-anchor .composer-reference-menu[data-side="above"] { inset: auto auto 6px 0; }
.composer-reference-head { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.composer-reference-head button { font-size: 20px; line-height: 1; }
.reference-choice-group { display: grid; gap: 3px; }
.reference-group-label { padding: 6px 9px 2px; color: var(--muted); font-size: 12px; }
.reference-option[aria-selected="true"] { background: var(--gold-soft); color: var(--gold-dark); }
#composer-reference-status { font-size: 13px; }
#composer-reference-status:empty { display: none; }
.composer-reference-chips, .message-skills {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; font-size: 12px;
}
.composer-reference-chips { margin: 0 16px 6px; }
.message-skills { margin: 8px 0 0; }
.composer-reference-chip, .message-skills li {
  display: inline-flex; gap: 5px; align-items: center; padding: 3px 7px; border: 1px solid var(--gold-line);
  border-radius: 8px; background: var(--gold-soft); color: var(--gold-dark); overflow-wrap: anywhere; min-width: 0; max-width: 100%;
}
.composer-reference-chip[data-kind="artifact"] { background: var(--canvas); color: var(--ink); border-color: var(--line); }
.composer-reference-chip button { min-width: 23px; min-height: 23px; border: 0; background: transparent; color: inherit; line-height: 1; }
.composer-reference-chip button:hover { background: var(--surface-hover); }
.reference-symbol { font-weight: 700; }
#choose-skill[aria-expanded="true"] { background: var(--gold-soft); color: var(--gold-dark); }
.skill-installation-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 3px; }
.skill-installation-actions .subtle { font-size: 12px; }
.skill-preset-coverage { color: var(--muted); font-size: 13px; }
.skill-preset-coverage ul { margin: 6px 0; padding-inline-start: 18px; }
.skill-preset-coverage a { color: var(--gold-dark); text-decoration: underline; text-underline-offset: .18em; }
#personal-skill-heading { margin-top: 24px; }
#expert-menu .composer-popover { max-height: min(370px, 42dvh); overflow: auto; }
#expert-draft-options { display: grid; gap: 8px; }
#expert-draft-options .choice-list { max-height: none; overflow: visible; }
.current-expert-profile { display: grid; gap: 8px; padding: 10px 11px; border-radius: 8px; background: var(--canvas); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.expert-profile-header { display: flex; align-items: center; gap: 10px; }
.expert-profile-header h2 { margin: 0 0 2px; font-size: 15px; }
.expert-profile-header .expert-portrait { width: 36px; height: 36px; border-radius: 50%; }
.current-expert-profile .capability-tags > span { background: var(--paper); font-size: 12px; }
.choice-list { display: flex; flex-direction: column; gap: 3px; max-height: min(260px, 37dvh); overflow: auto; padding: 2px; }
.choice-list > * { flex: none; }
.choice-list > .subtle { padding: 8px; font-size: 13px; }
.choice-option { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 7px 9px; border: 0; border-radius: 6px; text-align: start; color: var(--ink); background: var(--paper); overflow-wrap: anywhere; }
.choice-option:hover { background: var(--sidebar); }
.choice-option[aria-pressed="true"] { background: var(--gold-soft); color: var(--gold-dark); }
.choice-option .expert-portrait { width: 35px; height: 35px; border-radius: 7px; }
.choice-option-copy { min-width: 0; }
.choice-option-copy :is(strong, small) { display: block; }
.choice-option-copy small { margin-top: 2px; color: var(--muted); line-height: 1.5; }
.choice-option-copy small + small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.popover-links { padding: 7px 8px 1px; border-top: 1px solid var(--line); }
.workspace-create { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
#workspace-status { font-size: 13px; }
#workspace-status:empty { display: none; }
#task-model { display: block; max-width: min(100%, 240px); color: var(--ink); text-align: end; text-align-last: end; text-overflow: ellipsis; }
#task-model option { text-align: start; text-align-last: start; }
#task-model:disabled { opacity: .65; }
.conversation-execution { margin-top: 7px; font-size: 13px; }
.scene-group { margin-top: 24px; }
.scene-group > h2 { margin: 0 0 11px; font-size: 19px; }
.scene-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.scene-card { padding: 18px; min-height: 188px; }
.scene-card h3 { font-family: inherit; font-size: 16px; font-weight: 650; }
.scene-card p { color: var(--muted); font-size: 13px; }
.scene-card button { width: 100%; margin-top: auto; color: var(--gold-dark); border-color: #d9b28a; }
@media (max-width: 1150px) { .scene-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1040px) { .directory-head { grid-template-columns: 1fr; gap: 12px; } }
@media (max-width: 760px) {
  .composer-popover {
    position: fixed;
    inset: auto 12px max(12px, env(safe-area-inset-bottom));
    width: auto;
    max-height: calc(100dvh - 24px);
    overflow: auto;
  }
}
@media (max-width: 520px) {
  .library-tabs, .library-tab-group { gap: 3px; }
  .library-tabs a { padding-inline: 7px; font-size: 13px; }
  .catalog-filters, .catalog-search { gap: 8px; }
  .catalog-card { padding: 13px; }
  .choice-control { min-height: 40px; }
  .composer-toolbar .choice-control { padding-inline: 5px; }
  #choose-skill .composer-label { display: none; }
  #task-model { min-width: 0; max-width: min(190px, 46vw); }
  .scene-grid { grid-template-columns: 1fr; }
  .scene-card { min-height: 0; }
  .expert-card { min-height: 0; padding: 15px; }
  .expert-card-header { gap: 10px; }
  .expert-portrait { width: 56px; height: 56px; border-radius: 11px; }
}
