:root {
  --ink: #172434;
  --muted: #667789;
  --navy-950: #0d263a;
  --navy-900: #10344d;
  --navy-800: #174d68;
  --teal-700: #087986;
  --teal-600: #0b8d98;
  --teal-100: #dff3f3;
  --teal-50: #eefafa;
  --blue-50: #eef6fb;
  --green-700: #24754d;
  --green-50: #eaf7ef;
  --amber-700: #a76a0a;
  --amber-50: #fff5df;
  --red-700: #af3d3d;
  --red-50: #fff0f0;
  --gray-100: #eef2f4;
  --gray-50: #f7f9fa;
  --line: #dbe5ea;
  --paper: #fff;
  --canvas: #edf3f6;
  --radius-sm: 8px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --shadow: 0 16px 46px rgba(19, 56, 79, .1);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 2%, rgba(11, 141, 152, .11), transparent 28rem),
    var(--canvas);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  line-height: 1.6;
}

button,
input,
select { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

a { color: var(--teal-700); }

.app-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 30px auto 64px;
}

.home-shell { width: min(1200px, calc(100% - 48px)); margin: 24px auto; }

.home-hero {
  overflow: hidden;
  padding: 28px 34px;
  border-radius: 14px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 20%, rgba(143,226,229,.24), transparent 22rem),
    linear-gradient(125deg, var(--navy-950), var(--navy-800) 68%, var(--teal-700));
  box-shadow: var(--shadow);
}

.home-hero .eyebrow { margin-bottom: 8px; color: #9fe0e3; font-size: 10px; }
.home-hero h1 { margin: 0 0 10px; color: #fff; font-size: clamp(28px, 3vw, 36px); }
.home-hero p { max-width: 720px; margin: 0; color: #d9eff1; font-size: 14px; }

.home-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.home-entry {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  min-height: 170px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: inherit;
  background: rgba(255,255,255,.92);
  box-shadow: 0 12px 32px rgba(19,56,79,.08);
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.home-entry:hover { transform: translateY(-3px); border-color: #9bcbd0; box-shadow: 0 16px 34px rgba(19,56,79,.12); }
.home-entry--primary { border-color: #aed8dc; background: linear-gradient(145deg, #fff, var(--teal-50)); }
.home-entry__index { color: var(--teal-700); font: 750 12px Consolas, monospace; letter-spacing: .12em; }
.home-entry__index { align-self: center; }
.home-entry strong { margin: 0; color: var(--navy-900); font-size: 18px; }
.home-entry > span:not(.home-entry__index) { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.home-entry b { grid-column: 1 / -1; padding-top: 12px; color: var(--teal-700); font-size: 12px; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb a { text-decoration: none; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1 { margin-bottom: 6px; color: var(--navy-950); font-size: clamp(28px, 4vw, 42px); line-height: 1.2; letter-spacing: -.025em; }
h2 { color: var(--navy-900); font-size: 20px; }
h3 { color: var(--navy-800); font-size: 16px; }

.page-heading__desc { margin-bottom: 0; color: var(--muted); }

.count-card {
  min-width: 150px;
  padding: 13px 17px;
  border: 1px solid #c9dce3;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.75);
  text-align: right;
}

.count-card strong { display: block; color: var(--navy-900); font-size: 25px; line-height: 1.15; }
.count-card span { color: var(--muted); font-size: 12px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(145px, .8fr) auto minmax(130px, .8fr) minmax(210px, 1.35fr) minmax(115px, .65fr) auto;
  gap: 14px;
  align-items: end;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field { display: grid; gap: 6px; }
.field label { color: #496172; font-size: 12px; font-weight: 700; }
.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #cbd9e0;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
  outline: none;
}
.field input:focus,
.field select:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(11,141,152,.12); }

.segmented {
  display: flex;
  min-height: 40px;
  padding: 3px;
  border: 1px solid #cbd9e0;
  border-radius: 10px;
  background: var(--gray-50);
}

.segmented button {
  padding: 6px 13px;
  border: 0;
  border-radius: 7px;
  color: #526877;
  background: transparent;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] { color: #fff; background: var(--teal-700); box-shadow: 0 4px 12px rgba(8,121,134,.2); }
.segmented button:disabled { cursor: not-allowed; opacity: .42; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--teal-700);
  cursor: pointer;
  text-decoration: none;
}

.button:hover { background: #066c78; }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button--secondary { border-color: #c8d7df; color: #40596a; background: #fff; }
.button--secondary:hover { background: var(--gray-50); }

.auto-refresh { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.auto-refresh input { accent-color: var(--teal-700); }

.table-scroller { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th,
.data-table td { padding: 15px 16px; border-bottom: 1px solid #e7edf1; text-align: left; vertical-align: middle; }
.data-table th { color: #3d596a; background: #f5f8fa; font-size: 12px; font-weight: 750; white-space: nowrap; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: #f9fcfd; }
.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table--profiles {
  min-width: 1280px;
  table-layout: fixed;
}

.profile-col--agent { width: 16%; }
.profile-col--description { width: 20%; }
.profile-col--industry { width: 13%; }
.profile-col--scenario { width: 18%; }
.profile-col--skill { width: 13%; }
.profile-col--status { width: 7%; }
.profile-col--time { width: 13%; }
.agent-description { color: #526777; white-space: pre-wrap; }

.data-table--profiles th,
.data-table--profiles td { overflow-wrap: anywhere; }

.data-table--profiles td { vertical-align: top; }
.data-table--profiles .tag-list { min-width: 0; }
.data-table--profiles .tag { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.data-table--profiles .time { white-space: normal; }

.data-table--skills {
  min-width: 0;
  table-layout: fixed;
}

.skill-col--name { width: 15%; }
.skill-col--description { width: 34%; }
.skill-col--scenario { width: 15%; }
.skill-col--io { width: 10%; }
.skill-col--prerequisite { width: 7%; }
.skill-col--status { width: 6%; }
.skill-col--meta { width: 13%; }

#skills-table-wrap { overflow-x: hidden; }

.data-table--skills th,
.data-table--skills td { padding-right: 12px; padding-left: 12px; }

.data-table--skills td { min-width: 0; vertical-align: top; overflow-wrap: anywhere; }

.data-table--skills .tag-list {
  min-width: 0;
}

.data-table--skills .tag {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.agent-link { display: inline-block; max-width: 100%; color: var(--navy-800); font-weight: 750; overflow-wrap: anywhere; text-decoration: none; }
.agent-link:hover { color: var(--teal-700); text-decoration: underline; }
.cell-subline { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }

.project-id {
  display: block;
  margin-top: 6px;
  color: #425b6c;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.skill-name-list {
  display: grid;
  gap: 5px;
  width: 100%;
  justify-items: start;
}

.skill-name-list__item {
  width: auto;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 7px;
  color: #285a72;
  background: var(--blue-50);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 5px; min-width: 125px; }
.tag-list--stacked {
  display: grid;
  width: 100%;
  min-width: 0;
  align-items: start;
  justify-items: start;
}

.data-table--profiles .tag-list--stacked .tag {
  width: auto;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 7px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}
.tag,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.25;
  white-space: nowrap;
}
.tag { color: #16606b; background: var(--teal-100); font-size: 11px; }
.tag--empty { color: #6d7c87; background: var(--gray-100); }
.badge { color: #526471; background: var(--gray-100); font-size: 10px; font-weight: 700; }
.badge--created,
.badge--active { color: var(--green-700); background: var(--green-50); }
.badge--updated,
.badge--reviewed { color: #236583; background: var(--blue-50); }
.badge--draft { color: var(--amber-700); background: var(--amber-50); }
.badge--disabled { color: var(--red-700); background: var(--red-50); }

.time { color: #3d5464; white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

.profile-time {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.profile-time__line {
  min-height: 21px;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 65px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.pagination { display: flex; align-items: center; gap: 9px; }

.state {
  display: grid;
  min-height: 280px;
  padding: 40px 20px;
  place-items: center;
  text-align: center;
}
.state[hidden] { display: none; }
.state__body { max-width: 430px; }
.state__icon { display: grid; width: 52px; height: 52px; margin: 0 auto 13px; place-items: center; border-radius: 16px; color: var(--teal-700); background: var(--teal-50); font-size: 22px; font-weight: 800; }
.state h2 { margin-bottom: 5px; }
.state p { margin-bottom: 17px; color: var(--muted); }

.loading-line { height: 3px; overflow: hidden; background: #e4edef; }
.loading-line::after { display: block; width: 35%; height: 100%; background: var(--teal-600); animation: loading 1.1s infinite ease-in-out; content: ""; }
.loading-line[hidden] { display: none; }
@keyframes loading { from { transform: translateX(-110%); } to { transform: translateX(390%); } }

.detail-header { padding: 26px 28px; }
.detail-header__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.detail-header h1 { margin-bottom: 8px; font-size: clamp(27px, 4vw, 38px); }
.detail-description { max-width: 980px; margin: 18px 0 0; color: #4f6574; white-space: pre-wrap; }

.alert { margin: 18px 0 0; padding: 12px 14px; border: 1px solid #eed5a1; border-radius: 10px; color: #805817; background: var(--amber-50); font-size: 13px; }
.alert[hidden] { display: none; }

.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.meta-item { min-height: 88px; padding: 15px; background: #fbfdfe; }
.meta-item dt { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.meta-item dd { margin: 0; color: #314c5d; font-size: 13px; }
.meta-item--skill-count { grid-column: span 2; }
.meta-item--scenarios { grid-column: 1 / -1; min-height: 0; }
.meta-item--scenarios .tag-list {
  display: grid;
  gap: 6px;
  min-width: 0;
  justify-items: start;
}
.meta-item--scenarios .tag {
  display: block;
  width: fit-content;
  max-width: 100%;
  border-radius: 7px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}

.section-panel { margin-top: 20px; }
.section-panel__header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.section-panel__header h2 { margin: 0; }

.skill-name { color: var(--navy-800); font-weight: 750; }
.skill-description { color: #526777; white-space: pre-wrap; }
.skill-value-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-value-button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--teal-700); background: var(--teal-50); font: inherit; font-size: 12px; cursor: pointer; }
.skill-value-button:hover { background: var(--teal-100); }
.skill-value-button:focus-visible { outline: 2px solid var(--teal-600); outline-offset: 2px; }
.skill-value-dialog { width: min(760px, calc(100% - 32px)); max-height: 85vh; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fff; box-shadow: 0 20px 70px #17364430; }
.skill-value-dialog::backdrop { background: #13303e66; }
.skill-value-dialog__header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.skill-value-dialog__header h2 { min-width: 0; margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.skill-value-dialog__header button { flex-shrink: 0; }
.skill-value-dialog__content { margin: 0; padding: 22px; color: #425b6c; font: 13px/1.7 Consolas, "SFMono-Regular", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.skill-meta { display: grid; gap: 7px; }
.data-table--skills .time { white-space: normal; }

.back-link { display: inline-flex; align-items: center; gap: 6px; border: 0; color: var(--teal-700); background: transparent; cursor: pointer; text-decoration: none; }

.noscript { margin: 24px; padding: 16px; border: 1px solid #efcaca; border-radius: 10px; color: var(--red-700); background: var(--red-50); }

@media (max-width: 1040px) {
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 28px, 1440px); }
  .app-shell { margin-top: 22px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .count-card { text-align: left; }
  .toolbar { grid-template-columns: 1fr; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .table-footer { align-items: stretch; flex-direction: column; }
  .pagination { justify-content: space-between; }
  .detail-header { padding: 21px; }
  .detail-header__top { flex-direction: column; }
  .meta-grid { grid-template-columns: 1fr; }
  .meta-item--skill-count,
  .meta-item--scenarios { grid-column: 1; }
}

@media (max-width: 1100px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-entry { min-height: 150px; }
}

@media (max-height: 700px) and (min-width: 761px) {
  .home-shell { margin-block: 16px; }
  .home-hero { padding: 18px 26px; }
  .home-hero h1 { font-size: 28px; margin-bottom: 6px; }
  .home-grid { gap: 12px; margin-top: 12px; }
  .home-entry { min-height: 140px; padding: 16px; gap: 6px; }
  .home-entry strong { font-size: 16px; }
  .home-entry b { padding-top: 8px; }
}

@media (max-width: 600px) {
  .home-shell { margin-block: 16px; }
  .home-hero { padding: 22px; }
  .home-grid { grid-template-columns: 1fr; gap: 12px; }
  .home-entry { min-height: 0; padding: 18px; }
}

@media (max-width: 900px) {
  .data-table--responsive thead { display: none; }
  .data-table--responsive,
  .data-table--responsive tbody,
  .data-table--responsive tr,
  .data-table--responsive td { display: block; width: 100%; }
  .data-table--responsive tbody { padding: 10px 14px; }
  .data-table--responsive.data-table--profiles { min-width: 0; table-layout: auto; }
  .data-table--responsive.data-table--skills { min-width: 0; table-layout: auto; }
  .data-table--responsive tr { margin: 10px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 11px; }
  .data-table--responsive td { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; padding: 8px 0; border: 0; }
  .data-table--responsive td::before { color: var(--muted); content: attr(data-label); font-size: 11px; font-weight: 700; }
  .data-table--responsive .skill-description { min-width: 0; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
