:root {
  color-scheme: light;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #24223a;
  background: #f6f7fb;
  font-synthesis: none;
  --ink: #24223a;
  --muted: #625e75;
  --border: #e3e2ec;
  --accent: #583bc1;
  --violet-light: #efebfe;
  --panel: #fff;
  --sidebar: 16.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
body { min-width: 18rem; margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
h1, h2, h3, p, ol, pre { margin: 0; }
a { color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.topbar {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr auto;
  align-items: center;
  min-height: 4.25rem;
  padding-right: 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding-left: 1.5rem;
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -.035em;
}

.brand-mark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 0 2.15rem;
  height: 2.15rem;
  border-radius: .65rem;
  background: #302263;
  box-shadow: 0 2px 4px #3022632e;
}

.brand-mark i { width: .55rem; height: 3px; border-radius: 2px; background: #daceff; }
.brand-mark i:nth-child(2) { width: .75rem; background: #e3d6ff; }
.brand-mark i:nth-child(3) { width: .95rem; background: #fff; }

.workspace-label {
  width: fit-content;
  border-left: 1px solid var(--border);
  padding-left: 1.4rem;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 580;
}

.source-select { position: relative; }
.source-select::before {
  content: "";
  position: absolute;
  top: 50%;
  left: .8rem;
  width: .42rem;
  height: .42rem;
  border-radius: 50%;
  background: #8b69ed;
  transform: translateY(-50%);
  pointer-events: none;
}
.source-select:has(option[value="live"]:checked)::before { background: #268462; }
.source-select::after {
  content: "";
  position: absolute;
  right: .9rem;
  top: 45%;
  width: .4rem;
  height: .4rem;
  border: solid #77718c;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
.source-select select {
  appearance: none;
  min-height: 2.25rem;
  padding: .4rem 2rem .4rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  background: #faf9fe;
  color: var(--ink);
  font-size: .875rem;
  font-weight: 650;
}
.session-controls { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; }
.session-controls .action-button { white-space: nowrap; }
.account-name { max-width: 9rem; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: .87rem; font-weight: 650; }

.sign-in { display: grid; min-height: calc(100dvh - 4.25rem); place-items: start center; padding: clamp(2.25rem, 8vh, 5rem) 1rem; }
.sign-in-card { width: min(100%, 27rem); overflow: hidden; border: 1px solid var(--border); border-radius: .9rem; background: var(--panel); box-shadow: 0 .65rem 2rem #2c204315; }
.sign-in-heading { padding: 1.6rem 1.6rem 1.4rem; background: linear-gradient(112deg, #231938, #483477); color: #fff; }
.sign-in-heading h1, .admin-heading h1 { font-size: 1.9rem; letter-spacing: -.055em; line-height: 1.12; }
.sign-in-heading p { margin-top: .5rem; color: #e1d7f3; line-height: 1.45; }
.account-form { display: grid; gap: .45rem; padding: 1.4rem 1.6rem; }
.account-form label { margin-top: .35rem; font-size: .92rem; font-weight: 650; }
.account-form input, .audit-controls select {
  min-width: 0;
  min-height: 2.55rem;
  padding: .55rem .65rem;
  border: 1px solid #dcd5e9;
  border-radius: .45rem;
  background-color: #fdfcff;
  color: var(--ink);
}
.account-form .action-button { min-height: 2.5rem; margin-top: .55rem; }
.account-error { padding: .55rem .7rem; border-radius: .4rem; background: #fcecf0; color: #90334e; font-size: .9rem; line-height: 1.45; }
.first-admin-help { padding: .95rem 1.6rem 1.1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .89rem; line-height: 1.5; }
.first-admin-help summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.first-admin-help p { margin-top: .45rem; }
.first-admin-help code { display: block; margin-top: .5rem; padding: .55rem .65rem; border-radius: .4rem; background: #f7f4fd; color: #4d377b; overflow-wrap: anywhere; }

.admin-dashboard { width: min(100%, 80rem); margin: 0 auto; padding: 2rem 2rem 3rem; }
.admin-notice { margin-top: .55rem; color: var(--muted); }
.admin-panel { margin-top: 1rem; border: 1px solid var(--border); border-radius: .85rem; background: var(--panel); }
.admin-panel-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1.15rem 1.25rem; }
.admin-panel-header h2 { font-size: 1.12rem; letter-spacing: -.028em; }
.admin-table-wrap { overflow-x: auto; border-radius: 0 0 .85rem .85rem; }
.admin-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .91rem; line-height: 1.5; }
.admin-table :is(th, td) { padding: .7rem .9rem; border-top: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.admin-table thead th { background: #f7f5fb; color: #504665; white-space: nowrap; }
.admin-table tr > :first-child { padding-left: 1.25rem; }
.admin-table tr > :last-child { padding-right: 1.25rem; }
.account-role { display: inline-block; padding: .1rem .5rem; border-radius: .35rem; background: #f0eef5; color: #534969; font-weight: 630; }
.account-role.admin { background: #f1ebff; color: #5b379d; }
.audit-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-details { color: var(--muted); }
.audit-details span { color: var(--ink); font-weight: 600; }
.audit-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.audit-controls label { color: var(--muted); font-size: .88rem; font-weight: 650; }
.audit-controls select {
  appearance: none;
  min-height: 2.05rem;
  max-width: 13rem;
  padding: .32rem 1.9rem .32rem .55rem;
  background-image: linear-gradient(45deg, transparent 50%, #77718c 50%), linear-gradient(135deg, #77718c 50%, transparent 50%);
  background-position: calc(100% - .95rem) 52%, calc(100% - .65rem) 52%;
  background-size: .3rem .3rem;
  background-repeat: no-repeat;
  font-size: .88rem;
}
.admin-message, .admin-pagination { padding: 1rem 1.25rem; border-top: 1px solid var(--border); color: var(--muted); }
.admin-pagination { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.editor-fields #register-username, .editor-fields #register-password { margin-bottom: 0; }
.editor-fields .register-hint + label { margin-top: .95rem; }

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: calc(100dvh - 4.25rem);
}
.sidebar { padding: 1.85rem 1rem; border-right: 1px solid var(--border); background: var(--panel); }
.sidebar-heading { display: flex; align-items: center; gap: .55rem; padding: 0 .45rem; }
.sidebar-heading h2 { font-size: 1.03rem; letter-spacing: -.025em; }
.category-navigation { margin-bottom: 1.25rem; padding-bottom: 1.15rem; border-bottom: 1px solid var(--border); }
#manage-categories { margin-left: auto; }
.categories { display: grid; gap: .2rem; margin-top: .6rem; }
.category-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .55rem;
  min-height: 2.25rem;
  padding: .36rem .56rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  background: transparent;
  color: #463d5a;
  text-align: left;
  font-size: .88rem;
  font-weight: 610;
}
.category-item:hover { background: #f8f7fd; }
.category-item[aria-pressed="true"] { border-color: #e5dcf8; background: #f2edfc; color: #4b318a; }
.category-label { overflow-wrap: anywhere; }
.category-count { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.category-icon { position: relative; width: .83rem; height: .62rem; border: 1.4px solid #817296; border-radius: .13rem; }
.category-icon::before {
  content: "";
  position: absolute;
  top: -.25rem;
  left: -.08rem;
  width: .42rem;
  height: .22rem;
  border: solid #817296;
  border-width: 1.4px 1.4px 0;
  border-radius: .12rem .15rem 0 0;
}
.sidebar-heading #new-agent { margin-left: auto; white-space: nowrap; }
#new-agent span { font-size: 1.05em; }
.count {
  min-width: 1.42rem;
  padding: .12rem .35rem;
  border-radius: 1rem;
  background: #f0eef7;
  color: #5e5478;
  text-align: center;
  font-size: .8rem;
  font-weight: 680;
}
.search {
  display: flex;
  position: relative;
  margin: 1rem .38rem 1.15rem;
}
.search input {
  width: 100%;
  min-height: 2.5rem;
  padding: .5rem .65rem .5rem 2.15rem;
  border: 1px solid var(--border);
  border-radius: .55rem;
  background: #f9f9fc;
  color: var(--ink);
  font-size: .875rem;
}
.search input::placeholder { color: #69667b; }
.search input:disabled { opacity: .6; }
.search-icon {
  position: absolute;
  top: .78rem;
  left: .76rem;
  width: .7rem;
  height: .7rem;
  border: 1.5px solid #716c85;
  border-radius: 50%;
  pointer-events: none;
}
.search-icon::after {
  content: "";
  position: absolute;
  width: .34rem;
  height: 1.5px;
  left: .46rem;
  top: .53rem;
  background: #716c85;
  transform: rotate(45deg);
}
.agents { display: grid; gap: .32rem; }
.directories { display: flex; gap: .35rem; margin: -.42rem .38rem .65rem; }
.directories button {
  flex: 1;
  padding: .43rem .55rem;
  border: 1px solid transparent;
  border-radius: .42rem;
  background: transparent;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 650;
}
.directories button:hover { background: #f8f6fd; }
.directories button[aria-pressed="true"] { border-color: #ebe4f9; background: #f2edfc; color: #553a92; }
.agent-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: .72rem;
  padding: .68rem .65rem;
  border: 1px solid transparent;
  border-radius: .65rem;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.agent-item:hover { background: #f8f7fd; }
.agent-item[aria-pressed="true"] { border-color: #ddd2fb; background: #f2edff; }
.agent-item[aria-pressed="true"] .agent-name { color: #452a90; }
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 2.25rem;
  height: 2.25rem;
  border-radius: .56rem;
  background: #e7dbfc;
  color: #5635a8;
  font-size: .95rem;
  font-weight: 760;
  letter-spacing: -.05em;
}
.avatar.teal { background: #def2ed; color: #216855; }
.avatar.rose { background: #f9e5ed; color: #963f63; }
.avatar.amber { background: #faefd7; color: #815615; }
.agent-item-text { display: grid; min-width: 0; gap: .17rem; }
.agent-name { overflow-wrap: anywhere; font-size: .91rem; font-weight: 680; }
.agent-category, .sidebar-message { color: var(--muted); font-size: .81rem; line-height: 1.3; }
.sidebar-message { padding: .6rem; }

.main { width: 100%; max-width: 92rem; margin: 0 auto; padding: 1.95rem 2rem 3rem; }
.profile {
  display: flex;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 9.4rem;
  padding: 1.65rem 1.9rem;
  border: 1px solid #2b2250;
  border-radius: 1rem;
  background: radial-gradient(ellipse at 98% 125%, #5d3ea5 0, transparent 60%), linear-gradient(105deg, #211838, #312356);
  color: #fff;
  box-shadow: 0 5px 12px #28184916;
}
.profile::before {
  content: "";
  z-index: -1;
  position: absolute;
  top: 50%;
  right: -2rem;
  width: 20rem;
  height: 20rem;
  border: 1px solid #ffffff22;
  border-radius: 50%;
  box-shadow: 0 0 0 1.65rem #ffffff0a, 0 0 0 3.25rem #ffffff0a, 0 0 0 4.9rem #ffffff08;
  transform: translateY(-50%);
  pointer-events: none;
}
.profile-main { display: flex; align-items: center; min-width: 0; gap: 1rem; }
.profile-avatar {
  flex-basis: 3.75rem;
  height: 3.75rem;
  border: 1px solid #c1a7fc77;
  border-radius: .9rem;
  background: #9c74ec3b;
  color: #f1e9ff;
  font-size: 1.65rem;
}
.profile h1 { font-size: clamp(1.8rem, 3.1vw, 2.65rem); letter-spacing: -.055em; line-height: 1.08; overflow-wrap: anywhere; }
.profile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: .55rem; color: #e4d7fc; font-size: .91rem; }
.profile-meta span::before { content: "·"; margin-right: .55rem; }
.profile-category {
  max-width: 100%;
  padding: .23rem .53rem;
  border: 1px solid #d8c8f26e;
  border-radius: .42rem;
  background: #f0e4ff13;
  color: #f1e8ff;
  font-size: .86rem;
  font-weight: 650;
  text-align: left;
  overflow-wrap: anywhere;
}
.profile-category::after {
  content: "";
  display: inline-block;
  width: .34rem;
  height: .34rem;
  margin: 0 .1rem .16rem .5rem;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.profile-category:hover { background: #f0e4ff2e; }
.profile-category:focus-visible { outline-color: #e5d6fa; }
.profile-version {
  display: grid;
  flex: 0 0 auto;
  align-content: center;
  gap: .16rem;
  min-width: 8rem;
  padding: .7rem .95rem;
  border: 1px solid #e8d9ff43;
  border-radius: .75rem;
  background: #37235a45;
  color: #ebdfff;
}
.profile-version span { font-size: .84rem; font-weight: 630; }
.profile-version strong { color: #fff; font-size: 1.85rem; line-height: 1; letter-spacing: -.055em; }
.agent-sections {
  display: flex;
  gap: .35rem;
  margin-top: 1.15rem;
  border-bottom: 1px solid var(--border);
}
.agent-sections button {
  margin-bottom: -1px;
  padding: .65rem 1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: .95rem;
  font-weight: 680;
}
.agent-sections button:hover { color: var(--accent); }
.agent-sections button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.profile-controls { display: flex; align-items: center; gap: .85rem; }
.agent-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.action-button {
  min-height: 2.05rem;
  padding: .38rem .65rem;
  border: 1px solid transparent;
  border-radius: .45rem;
  font-size: .875rem;
  font-weight: 670;
  line-height: 1.25;
}
.action-button.primary { border-color: #583bc1; background: #583bc1; color: #fff; }
.action-button.primary:hover { background: #482da5; }
.action-button.neutral { border-color: #e0d8ef; background: #faf8fe; color: #4d377b; }
.action-button.neutral:hover { background: #f0eafa; }
.action-button.danger { border-color: #a43255; background: #a43255; color: #fff; }
.action-button.danger:hover { background: #8d2747; }
.action-button.profile-button { border-color: #e9deff61; background: #34245275; color: #f1e9ff; }
.action-button.profile-button:hover { background: #6e52a8; }
.action-button.profile-primary { border-color: #f3eaff; background: #f3eaff; color: #3e286d; }
.action-button.profile-primary:hover { background: #e5d6fa; }
.profile .action-button:focus-visible { outline-color: #e5d6fa; }

.detail {
  display: grid;
  grid-template-columns: minmax(13rem, .95fr) minmax(0, 2.55fr);
  align-items: start;
  gap: 1.35rem;
  margin-top: 1rem;
}
.history, .comparison {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: .85rem;
  background: var(--panel);
  box-shadow: 0 2px 4px #22203d06;
}
.criteria-panel, .quality-panel {
  container-type: inline-size;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: .85rem;
  background: var(--panel);
  box-shadow: 0 2px 4px #22203d06;
}
.criteria-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1.15rem 1.25rem .7rem; }
.criteria-header h2 { font-size: 1.12rem; letter-spacing: -.03em; }
.criteria-header p { margin-top: .3rem; color: var(--muted); font-size: .9rem; }
.criteria-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.quality-result { padding: 1rem 1.25rem 1.25rem; }
.quality-overview {
  display: grid;
  grid-template-columns: minmax(10rem, .72fr) minmax(0, 1fr);
  align-items: center;
  gap: 1.25rem;
  padding: 1.12rem;
  border: 1px solid #e6ddf7;
  border-radius: .65rem;
  background: #f8f5fd;
  line-height: 1.5;
}
.quality-version, .quality-meta, .quality-method { color: var(--muted); font-size: .88rem; }
.quality-version { font-weight: 650; }
.quality-score { margin: .1rem 0; color: #392767; font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 750; letter-spacing: -.05em; }
.quality-score small { color: var(--muted); font-size: .55em; font-weight: 600; }
.quality-overview progress { width: min(100%, 14rem); height: .65rem; accent-color: var(--accent); }
.quality-meta { margin-top: .3rem; }
.quality-breakdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; margin: .85rem 0 0; }
.quality-breakdown div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: .5rem; }
.quality-breakdown dt { color: var(--muted); font-size: .87rem; }
.quality-breakdown dd { margin: 0; font-weight: 700; }
.quality-method { margin-top: .9rem; line-height: 1.5; }
.quality-stale, .quality-error { margin-bottom: .8rem; padding: .65rem .75rem; border-radius: .4rem; font-size: .9rem; }
.quality-stale { background: #fbf0dc; color: #714a14; }
.quality-error { background: #fcecf0; color: #90334e; }

@container (max-width: 32rem) {
  .quality-overview { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .quality-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.criteria-placeholder { margin: 0 1.25rem .9rem; color: var(--muted); font-size: .85rem; }
.criteria-message { padding: 1.25rem; border-top: 1px solid var(--border); color: var(--muted); }
.criteria-message h3 { margin-bottom: .35rem; color: var(--ink); font-size: 1rem; }
.criteria-table-wrap { overflow-x: auto; border-radius: 0 0 .85rem .85rem; }
.criteria-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .91rem; line-height: 1.5; }
.criteria-table :is(th, td) { padding: .85rem .8rem; border-top: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.criteria-table thead th { background: #f7f5fb; color: #504665; white-space: nowrap; }
.criteria-table tr > :first-child { padding-left: 1.25rem; }
.criteria-table tr > :last-child { padding-right: 1.25rem; }
.criterion-text { width: 24%; font-weight: 650; white-space: pre-wrap; }
.criterion-summary { width: 25%; }
.criteria-date { min-width: 6.95rem; }
.criteria-date time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.criteria-version { display: block; margin-top: .15rem; color: var(--muted); font-size: .8rem; }
.criteria-muted { color: var(--muted); }
.criterion-status { display: inline-block; padding: .18rem .5rem; border-radius: .4rem; font-size: .84rem; font-weight: 680; }
.criterion-status.pending { background: #f0eef5; color: #534969; }
.criterion-status.present { background: #e5f5ec; color: #236449; }
.criterion-status.proposed_change { background: #f1ebff; color: #5b379d; }
.criterion-status.not_recommended { background: #fcecf0; color: #90334e; }
.criterion-summary details { margin-top: .5rem; }
.criterion-summary summary { cursor: pointer; color: var(--accent); font-weight: 620; }
.criterion-summary details p { padding: .5rem 0 0 1rem; color: var(--muted); }
.criterion-action button { white-space: nowrap; }

@container (max-width: 53rem) {
  .criteria-table-wrap { padding: .75rem; border-top: 1px solid var(--border); }
  .criteria-table, .criteria-table tbody { display: block; }
  .criteria-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .criteria-table tbody tr { display: grid; grid-template-columns: 1.15fr 1fr 1fr; padding: .65rem; border: 1px solid var(--border); border-radius: .6rem; }
  .criteria-table tbody tr + tr { margin-top: .65rem; }
  .criteria-table tbody :is(th, td), .criteria-table tr > :is(:first-child, :last-child) { width: auto; min-width: 0; padding: .3rem; border: 0; }
  .criteria-table .criteria-date time { white-space: normal; }
  .criteria-table [data-label]::before { content: attr(data-label); display: block; margin-bottom: .2rem; color: var(--muted); font-size: .78rem; font-weight: 650; }
  .criterion-text, .criterion-summary, .criterion-action { grid-column: 1 / -1; }
  .criterion-summary { margin-top: .2rem; }
  .criterion-action:empty { display: none; }
}
.history-header { padding: 1.15rem 1.15rem .85rem; }
.history-header h2, .comparison-header h2 { font-size: 1.12rem; letter-spacing: -.03em; }
.history-header > span, .comparison-header p { display: block; margin-top: .3rem; color: var(--muted); font-size: .875rem; }
.versions { list-style: none; padding: 0 .6rem .6rem; }
.version-row { position: relative; }
.version-row:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 1.04rem;
  top: 1.42rem;
  bottom: -.95rem;
  width: 1px;
  background: #ddd7ee;
  pointer-events: none;
}
.version-button {
  display: flex;
  width: 100%;
  gap: .62rem;
  padding: .73rem .74rem;
  border: 1px solid transparent;
  border-radius: .57rem;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.version-button:hover { background: #f8f6fd; }
.version-button[aria-pressed="true"] { border-color: #e5dbfc; background: #f4efff; }
.version-dot {
  position: relative;
  z-index: 1;
  flex: 0 0 .54rem;
  height: .54rem;
  margin-top: .31rem;
  border: 1.5px solid #9f94b7;
  border-radius: 50%;
  background: #fff;
}
.version-button[aria-pressed="true"] .version-dot { border-color: #7952da; background: #7952da; box-shadow: 0 0 0 3px #e7dcff; }
.version-text { display: grid; min-width: 0; gap: .27rem; }
.version-title { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .91rem; }
.current-badge { padding: .12rem .38rem; border-radius: .35rem; background: #ebe0fc; color: #57339f; font-size: .75rem; font-weight: 700; }
.version-text time { color: var(--muted); font-size: .875rem; }
.version-note { color: #504964; font-size: .8rem; line-height: 1.35; }

.comparison-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; padding: 1.15rem 1.25rem; border-bottom: 1px solid #efedf5; }
.comparison-header p strong { color: #51416f; }
.comparison-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .45rem; margin-left: auto; }
.comparison-header > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.view-switch {
  display: inline-flex;
  gap: .18rem;
  padding: .2rem;
  border: 1px solid #e9e6f1;
  border-radius: .55rem;
  background: #f5f3fa;
}
.view-switch button {
  padding: .35rem .62rem;
  border: 1px solid transparent;
  border-radius: .36rem;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
}
.view-switch button[aria-pressed="true"] {
  border-color: #e6dfef;
  background: #fff;
  color: #472d83;
  box-shadow: 0 1px 2px #28233e13;
}
.filters { display: flex; flex-wrap: wrap; gap: .42rem; padding: .95rem 1.25rem 0; }
.filter, .change-badge { border-radius: .4rem; font-size: .81rem; font-weight: 670; }
.filter { padding: .3rem .52rem; border: 1px solid transparent; }
.filter.all { background: #f1edf8; color: #51446d; }
.filter.modified, .change-badge.modified { background: #f1ebff; color: #5b379d; }
.filter.added, .change-badge.added { background: #e5f5ec; color: #236449; }
.filter.removed, .change-badge.removed { background: #fcecf0; color: #90334e; }
.filter[aria-pressed="true"] { border-color: currentColor; }
.filter:hover { filter: brightness(.96); }

.fields { display: grid; gap: .8rem; padding: .95rem 1.25rem 1.25rem; }
.field { min-width: 0; overflow: hidden; border: 1px solid #e6e2ee; border-radius: .62rem; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .72rem .85rem; }
.field-heading h3 { font-size: .95rem; letter-spacing: -.012em; overflow-wrap: anywhere; }
.change-badge { padding: .18rem .45rem; text-transform: capitalize; }
.field-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #ece8f1; }
.field-value { min-width: 0; padding: .66rem .85rem .83rem; background: #faf9fd; }
.field-value + .field-value { border-left: 1px solid #ece8f1; }
.modified .field-value.after { background: #f7f4fe; }
.added .field-value.after { background: #f0faf4; }
.removed .field-value.before { background: #fdf3f5; }
.value-label { display: block; margin-bottom: .32rem; color: #625974; font-size: .81rem; font-weight: 660; }
.field-value pre, .markdown { white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
.field-value pre { font-family: inherit; font-size: .96rem; line-height: 1.5; }
.missing-value { color: #6d667a; font-size: .92rem; font-style: italic; }
.markdown {
  margin: 1.25rem;
  padding: 1rem;
  border: 1px solid #e8e3f1;
  border-radius: .6rem;
  background: #f9f7fc;
  color: #3d2e58;
  font: .9rem/1.65 "SFMono-Regular", Consolas, monospace;
}
.markdown code { font: inherit; }
.markdown-preview {
  max-width: 54rem;
  margin-inline: auto;
  padding: clamp(1.2rem, 3vw, 2rem);
  overflow-x: auto;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.65;
}
.markdown-preview > * + * { margin-block-start: .9rem; }
.markdown-preview :is(h1, h2, h3, h4, h5, h6) { line-height: 1.25; letter-spacing: -.025em; }
.markdown-preview h1 { font-size: clamp(1.6rem, 3vw, 2rem); }
.markdown-preview h2 { margin-block-start: 1.55rem; font-size: 1.3rem; }
.markdown-preview h3 { margin-block-start: 1.2rem; font-size: 1.14rem; }
.markdown-preview :is(h4, h5, h6) { margin-block-start: 1rem; font-size: 1rem; }
.markdown-preview > :first-child { margin-block-start: 0; }
.markdown-preview :is(ol, ul) { margin-block-end: 0; padding-inline-start: 1.5rem; }
.markdown-preview li + li { margin-block-start: .2rem; }
.markdown-preview blockquote {
  margin-inline: 0;
  padding: .65rem .9rem;
  border-inline-start: 3px solid #b9a4e9;
  background: #f7f3fe;
  color: #504464;
}
.markdown-preview hr { border: 0; border-block-start: 1px solid var(--border); }
.markdown-preview img { max-width: 100%; height: auto; }
.markdown-preview code {
  padding: .12em .3em;
  border-radius: .25rem;
  background: #f2edf8;
  color: #4d377b;
  font: .88em "SFMono-Regular", Consolas, monospace;
}
.markdown-preview pre {
  overflow-x: auto;
  padding: .85rem 1rem;
  border: 1px solid #e8e3f1;
  border-radius: .55rem;
  background: #f9f7fc;
  line-height: 1.5;
}
.markdown-preview pre code { padding: 0; background: transparent; }
.markdown-preview table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.markdown-preview :is(th, td) { padding: .55rem .7rem; border: 1px solid var(--border); text-align: start; }
.markdown-preview th { background: #f5f1fb; color: #4a3768; }
.comparison-message, .workspace-message { padding: 1.25rem; color: var(--muted); line-height: 1.55; }
.workspace-message h1, .workspace-message h2 { color: var(--ink); }
.workspace-message h1 { font-size: 1.65rem; letter-spacing: -.04em; }
.workspace-message h2 { font-size: 1.16rem; }
.workspace-message p, .workspace-message .small-button { margin-top: .55rem; }
.small-button { padding: .32rem .65rem; border: 1px solid #d8cdef; border-radius: .4rem; background: #f4effe; color: #533994; font-size: .875rem; font-weight: 650; }

.notice {
  position: fixed;
  z-index: 2;
  bottom: 1.25rem;
  right: 1.25rem;
  max-width: calc(100% - 2.5rem);
  padding: .75rem 1rem;
  border: 1px solid #4b3674;
  border-radius: .6rem;
  background: #2b2045;
  color: #fff;
  box-shadow: 0 5px 18px #2b204533;
  font-size: .92rem;
  overflow-wrap: anywhere;
}
.notice:empty { padding: 0; border: 0; }
.agent-dialog {
  width: min(38rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  overflow: auto;
  border: 1px solid #dfd9eb;
  border-radius: .9rem;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1.3rem 4rem #24163f35;
}
.agent-dialog::backdrop { background: #20163788; }
.dialog-header { padding: 1.3rem 1.35rem 1rem; }
.dialog-header h2 { font-size: 1.32rem; letter-spacing: -.03em; overflow-wrap: anywhere; }
.dialog-header p { margin-top: .45rem; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  padding: .95rem 1.35rem;
  border-top: 1px solid #ede9f3;
  background: #fcfbfe;
}
.editor-fields {
  display: grid;
  min-width: 0;
  margin: 0;
  padding: 0 1.35rem 1rem;
  border: 0;
}
.editor-fields label { margin-bottom: .35rem; font-size: .91rem; font-weight: 690; }
.editor-fields input, .editor-fields textarea, .editor-fields select {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid #dcd5e9;
  border-radius: .45rem;
  background: #fdfcff;
  color: var(--ink);
}
.editor-fields input { margin-bottom: .9rem; }
.agent-category-field { display: grid; margin-bottom: .9rem; }
.editor-fields textarea { min-height: 8rem; resize: vertical; font: .9rem/1.55 "SFMono-Regular", Consolas, monospace; }
.editor-fields textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.editor-fields p { margin-top: .45rem; color: var(--muted); font-size: .85rem; }
.dialog-message { padding: 0 1.35rem 1rem; color: var(--muted); }
.dialog-error { margin: 0 1.35rem 1rem; padding: .65rem .75rem; border-radius: .4rem; background: #fcecf0; color: #90334e; }
.discard-prompt { padding: .95rem 1.35rem; border-top: 1px solid #ecdce5; background: #fdf4f7; }
.discard-prompt p { margin-bottom: .6rem; font-weight: 670; }
.discard-prompt > div { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
.category-dialog { width: min(32rem, calc(100% - 2rem)); }
.category-manager-list { display: grid; gap: .4rem; margin: 0 0 1rem; padding: 0 1.35rem; list-style: none; }
.category-manager-list:empty { margin: 0; }
.category-manager-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .4rem;
  padding: .48rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  overflow-wrap: anywhere;
}
.category-manager-list li > span { padding-inline: .25rem; font-weight: 650; }
#category-name { margin-bottom: 0; }

@media (max-width: 1130px) {
  :root { --sidebar: 14.2rem; }
  .main { padding-inline: 1.4rem; }
  .detail { gap: 1rem; }
}

@media (max-width: 960px) {
  :root { --sidebar: 12rem; }
  .brand { padding-left: .9rem; }
  .sidebar { padding-inline: .6rem; }
  .sidebar-heading { flex-wrap: wrap; }
  .sidebar-heading #new-agent { margin-left: 0; flex-basis: 100%; }
  .topbar { padding-right: 1.25rem; }
  .detail { grid-template-columns: minmax(10.7rem, 1fr) minmax(0, 2.5fr); }
  .main { padding-inline: 1.15rem; }
  .profile { padding-inline: 1.3rem; }
  .profile-controls { flex-direction: column; align-items: flex-end; gap: .55rem; }
  .comparison-header, .filters, .fields { padding-inline: .9rem; }
}

@media (max-width: 780px) {
  .topbar { grid-template-columns: 1fr auto; min-height: 3.85rem; }
  .workspace-label { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: 1rem 1.15rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-heading, .search { margin-inline: 0; padding-inline: 0; }
  .sidebar-heading #new-agent { margin-left: auto; flex-basis: auto; }
  .search { margin-block: .6rem; }
  .directories { margin: 0 0 .6rem; }
  .categories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agents { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding-top: 1.15rem; }
}

@media (max-width: 575px) {
  .topbar { padding-right: .9rem; }
  .brand { gap: .48rem; font-size: .92rem; }
  .brand-mark { flex-basis: 1.9rem; height: 1.9rem; }
  .session-controls { grid-column: 1 / -1; flex-wrap: wrap; justify-content: flex-start; padding: .4rem 0 .75rem .85rem; }
  .session-controls .account-name { max-width: 6rem; }
  .topbar:has(.session-controls:not([hidden])) .brand { padding-top: .75rem; }
  .admin-dashboard { padding: 1.3rem .85rem 2rem; }
  .audit-time { white-space: normal; min-width: 6rem; }
  .sidebar, .main { padding-inline: .85rem; }
  .detail { grid-template-columns: minmax(0, 1fr); margin-top: 1rem; }
  .profile { min-height: 7.5rem; flex-wrap: wrap; padding: 1rem .9rem; }
  .profile-main { flex: 1; gap: .55rem; }
  .profile-controls { display: contents; }
  .agent-actions { flex-basis: 100%; justify-content: flex-end; }
  .profile-avatar { flex-basis: 2rem; height: 2rem; font-size: 1.1rem; border-radius: .5rem; }
  .profile h1 { font-size: 1.55rem; }
  .profile-meta { font-size: .84rem; gap: .25rem; }
  .profile-meta span::before { margin-right: .25rem; }
  .profile-version { min-width: auto; padding: .5rem .55rem; }
  .profile-version span { font-size: .75rem; }
  .profile-version strong { font-size: 1.5rem; }
}

@media (max-width: 410px) {
  .field-values { grid-template-columns: minmax(0, 1fr); }
  .field-value + .field-value { border-left: 0; border-top: 1px solid #ece8f1; }
  .agent-item { gap: .45rem; padding-inline: .4rem; }
  .avatar { flex-basis: 1.96rem; height: 1.96rem; }
  .comparison-actions { margin-left: 0; justify-content: flex-start; }
}
