:root {
  color-scheme: light;
  --bg: #f4f8fd;
  --bg-soft: #eef5fc;
  --panel: #ffffff;
  --panel-muted: #f8fbff;
  --text: #07132b;
  --text-strong: #020817;
  --muted: #667996;
  --faint: #91a1b8;
  --border: #dbe5f3;
  --border-strong: #c7d6ea;
  --primary: #2568c7;
  --primary-strong: #1d56ad;
  --primary-soft: #e8f2ff;
  --primary-line: #b8d8ff;
  --green: #0f9f6e;
  --green-soft: #e8fbf3;
  --amber: #d68a00;
  --amber-soft: #fff7df;
  --danger: #c53a2d;
  --danger-soft: #fff1ef;
  --shadow: 0 18px 42px rgba(19, 49, 90, .08);
  --shadow-tight: 0 8px 22px rgba(26, 67, 116, .08);
  --grid:
    linear-gradient(rgba(37, 104, 199, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 104, 199, .055) 1px, transparent 1px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: .62;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}

input,
select {
  padding: 0 12px;
}

input::placeholder,
textarea::placeholder {
  color: #9aacc4;
}

textarea {
  min-height: 220px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--text-strong);
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  color: var(--text-strong);
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: 0;
}

p,
small {
  color: var(--muted);
  line-height: 1.55;
}

a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.login-shell {
  height: 100svh;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(560px, 36vw);
  gap: 0;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  background: #ffffff;
  animation: loginStageIn 420ms ease-out both;
}

.login-shell::before {
  content: "";
  position: absolute;
  inset: 0 max(560px, 36vw) 0 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(37, 104, 199, .1), transparent 30%),
    radial-gradient(circle at 76% 74%, rgba(37, 104, 199, .08), transparent 26%),
    var(--grid),
    linear-gradient(180deg, #f6faff 0%, #eef6ff 100%);
  background-size: auto, auto, 31px 31px, auto;
  z-index: 0;
}

.login-network {
  position: absolute;
  inset: 0 max(560px, 36vw) 0 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  animation: loginNetworkIn 900ms ease-out 80ms both;
}

.network-svg {
  width: 100%;
  height: 100%;
  opacity: .72;
}

.network-cluster {
  animation: networkClusterFloat 11s ease-in-out infinite alternate;
}

.network-cluster polyline {
  fill: none;
  stroke: rgba(84, 137, 207, .26);
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 22 14;
  animation: networkDash 6s linear infinite;
}

.network-cluster circle {
  fill: rgba(37, 104, 199, .34);
  filter: drop-shadow(0 0 4px rgba(37, 104, 199, .36));
  animation: networkPulse 3.8s ease-in-out infinite;
}

.network-cluster-a { animation-delay: -2s; }
.network-cluster-b { animation-delay: -6s; }
.network-cluster-c { animation-delay: -4s; }
.network-cluster-b polyline { stroke: rgba(84, 137, 207, .2); animation-delay: -2.4s; }
.network-cluster-c polyline { stroke: rgba(84, 137, 207, .18); animation-delay: -4.2s; }
.network-cluster-b circle { animation-delay: -1.2s; }
.network-cluster-c circle { animation-delay: -2.1s; }

.login-story {
  max-width: 880px;
  display: grid;
  gap: clamp(12px, 1.7vh, 19px);
  align-content: start;
  align-self: start;
  min-height: 0;
  padding: clamp(28px, 4vh, 52px) clamp(28px, 4vw, 56px) clamp(28px, 4vh, 52px) clamp(36px, 5vw, 76px);
  position: relative;
  z-index: 1;
}

.login-story > * {
  animation: loginItemRise 520ms ease-out both;
}

.login-story > *:nth-child(1) { animation-delay: 90ms; }
.login-story > *:nth-child(2) { animation-delay: 150ms; }
.login-story > *:nth-child(3) { animation-delay: 210ms; }
.login-story > *:nth-child(4) { animation-delay: 270ms; }
.login-story > *:nth-child(5) { animation-delay: 330ms; }
.login-story > *:nth-child(6) { animation-delay: 390ms; }

.login-brand-mark,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.login-brand-mark img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.login-brand-mark {
  width: min(300px, 26vw);
  height: clamp(68px, 7vw, 86px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.login-brand-mark .login-wordmark {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: left center;
  display: block;
  filter: contrast(1.04) saturate(1.05) drop-shadow(0 8px 18px rgba(37, 104, 199, .12));
}

.login-brand-mark div,
.sidebar-brand div {
  display: grid;
  min-width: 0;
}

.login-brand-mark strong,
.sidebar-brand strong {
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 900;
}

.login-brand-mark span,
.sidebar-brand span {
  color: #72839d;
  font-size: 12px;
  font-weight: 700;
}

.trust-pill,
.safe-login-pill,
.mini-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, .84);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(19, 49, 90, .12);
}

.login-copy {
  display: grid;
  gap: 14px;
}

.login-copy h1 {
  max-width: 800px;
  font-size: clamp(38px, 3.8vw, 56px);
  line-height: 1.06;
}

.login-copy h1 span {
  color: var(--primary);
  white-space: nowrap;
}

.login-copy p {
  max-width: 720px;
  color: #405575;
  font-size: clamp(15px, 1.3vw, 18px);
}

.login-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-tags span {
  min-height: 34px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, .76);
  color: #2d405e;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(19, 49, 90, .12);
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.login-tags span:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 9px 18px rgba(37, 104, 199, .22);
  transform: translateY(-1px);
}

.login-proof {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 142px));
  gap: 24px;
  margin-top: 2px;
}

.login-proof div {
  display: grid;
  gap: 5px;
  padding: 2px 0;
  filter: drop-shadow(0 7px 12px rgba(19, 49, 90, .1));
}

.login-proof strong {
  color: var(--text-strong);
  font-size: 26px;
  line-height: 1;
}

.login-proof span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-process-card {
  max-width: 860px;
  margin-top: 2px;
  padding: clamp(15px, 1.6vw, 18px) clamp(16px, 2vw, 20px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 18px 42px rgba(19, 49, 90, .14);
  position: relative;
  overflow: hidden;
}

.process-card-head,
.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.process-card-head div,
.section-title div {
  display: grid;
  gap: 5px;
}

.process-card-head strong {
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 900;
}

.process-card-head span,
.section-title p {
  color: var(--muted);
  font-size: 13px;
}

.process-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
  position: relative;
  z-index: 1;
}

.process-steps::before {
  display: none;
}

.process-step {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  position: relative;
  min-width: 0;
}

.process-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 24px;
  left: calc(50% + 30px);
  width: calc(100% - 48px);
  height: 1px;
  background:
    linear-gradient(90deg, rgba(173, 198, 232, .65), rgba(173, 198, 232, .65)),
    linear-gradient(90deg, transparent, rgba(37, 104, 199, 0), var(--primary), rgba(37, 104, 199, 0), transparent);
  background-size: 100% 100%, 220% 100%;
  background-position: 0 0, 120% 0;
  animation: processFlow 2.8s linear infinite;
  z-index: 0;
}

.step-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #b9d1f2;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #edf6ff);
  color: var(--primary);
  box-shadow: 0 10px 22px rgba(37, 104, 199, .16);
  position: relative;
  z-index: 1;
}

.process-step strong {
  color: var(--text-strong);
  font-size: 14px;
}

.process-step small {
  font-size: 12px;
}

.login-card {
  width: min(500px, calc(100% - clamp(72px, 8vw, 150px)));
  align-self: center;
  justify-self: center;
  padding: 36px 34px 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(11, 43, 83, .12);
  position: relative;
  z-index: 1;
  animation: loginCardIn 560ms cubic-bezier(.2, .8, .2, 1) 260ms both;
}

.safe-login-pill {
  box-shadow: none;
  margin-bottom: 18px;
}

.login-card h2 {
  margin-bottom: 8px;
  font-size: 27px;
}

.login-card > p {
  margin-bottom: 20px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span {
  color: #293b58;
  font-size: 13px;
  font-weight: 900;
}

.compact-field {
  min-width: 220px;
}

.btn-primary,
.btn-secondary,
.btn-table,
.btn-danger,
.icon-button,
.nav-button,
.segmented-control button,
.list-row {
  border: 1px solid transparent;
  border-radius: 6px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(37, 104, 199, .2);
}

.btn-primary:hover {
  background: var(--primary-strong);
  box-shadow: 0 12px 26px rgba(37, 104, 199, .26);
}

.btn-secondary,
.btn-table {
  background: #ffffff;
  border-color: var(--border);
  color: #263b5c;
  font-weight: 800;
}

.btn-secondary:hover,
.btn-table:hover {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary);
}

.btn-table,
.btn-danger {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.btn-danger {
  background: #ffffff;
  border-color: #ffc9c0;
  color: var(--danger);
  font-weight: 800;
}

.btn-danger:hover {
  background: var(--danger-soft);
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  background: #ffffff;
  border-color: var(--border);
  color: #5a6c86;
}

.icon-button:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.gate-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--grid), var(--bg-soft);
  background-size: 31px 31px;
}

.gate-state,
.data-section,
.readonly-block,
.admin-form,
.detail-panel,
.list-panel,
.side-card,
.admin-command-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-tight);
}

.gate-state {
  width: min(720px, 100%);
  padding: 34px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}

.gate-state img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.gate-state p {
  max-width: 580px;
}

.gate-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-top: 6px;
}

.onboarding-workspace {
  min-height: calc(100vh - 128px);
  display: grid;
  place-items: center;
}

.ticket-block {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-muted);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  background: var(--grid), linear-gradient(180deg, #f6faff, #eef5fc);
  background-size: 31px 31px, auto;
}

.app-sidebar {
  min-width: 0;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(14px);
  padding: 14px 12px;
}

.sidebar-brand {
  min-height: 50px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.sidebar-brand strong,
.sidebar-brand span,
.nav-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-label {
  display: block;
  margin: 18px 2px 8px;
  color: #8496af;
  font-size: 12px;
  font-weight: 900;
}

.sidebar-nav {
  display: grid;
  gap: 5px;
}

.nav-button {
  width: 100%;
  justify-content: flex-start;
  min-height: 40px;
  background: transparent;
  color: #536782;
  font-weight: 850;
  position: relative;
}

.nav-button:hover {
  background: #f1f6fc;
}

.nav-button[data-active="true"] {
  background: #eaf2fc;
  color: var(--primary);
  border-color: #d6e6f9;
}

.nav-button[data-active="true"]::before {
  content: "";
  position: absolute;
  left: -12px;
  width: 3px;
  height: 24px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.app-main {
  min-width: 0;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto;
  align-items: center;
  justify-content: end;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.user-chip {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.app-content {
  width: min(1260px, 100%);
  padding: 32px 34px 46px;
}

.page-transition {
  animation: pageTransitionIn 260ms ease-out both;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-header p {
  margin-top: 7px;
  font-size: 17px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 376px);
  gap: 26px;
}

.workspace-main,
.workspace-side {
  min-width: 0;
}

.workspace-side {
  display: grid;
  align-content: start;
  gap: 26px;
  padding-top: 97px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  min-height: 342px;
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(210, 232, 252, .95) 0%, rgba(255, 255, 255, .95) 42%, rgba(255, 255, 255, .9) 100%);
  box-shadow: var(--shadow);
}

.hero-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #bad3ef;
  border-radius: 8px;
  background: #d8ecff;
  color: var(--primary);
}

.hero-panel h2 {
  font-size: 30px;
}

.hero-panel p {
  max-width: 720px;
  color: #55708f;
  font-size: 16px;
}

.hero-search {
  min-height: 68px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 10px 10px 10px 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(23, 63, 108, .08);
  color: #8aa0bb;
}

.hero-search span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-prompts span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, .72);
  color: #2b3c57;
  font-size: 13px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 26px 0 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-tight);
}

.metric-panel {
  min-height: 78px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.metric-panel svg {
  grid-row: 1 / span 2;
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
}

.metric-panel span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-panel strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 24px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-section {
  padding: 18px;
  margin-top: 16px;
}

.section-title {
  margin-bottom: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px 16px;
}

.detail-grid span {
  color: var(--muted);
}

.detail-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.side-card {
  padding: 20px;
}

.side-card .section-title svg {
  color: var(--primary);
}

.graph-visual {
  position: relative;
  height: 176px;
  margin-top: 10px;
  background:
    linear-gradient(rgba(37, 104, 199, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 104, 199, .045) 1px, transparent 1px);
  background-size: 24px 24px;
}

.graph-visual::before,
.graph-visual::after {
  content: "";
  position: absolute;
  inset: 48px 36px auto 46px;
  height: 1px;
  background: #9bd9ee;
  transform: rotate(-18deg);
}

.graph-visual::after {
  inset: 92px 42px auto 54px;
  transform: rotate(24deg);
}

.graph-visual span {
  position: absolute;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255, 255, 255, .85);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(24, 73, 126, .08);
}

.node-customer {
  left: 16px;
  top: 58px;
  color: #2872cf;
}

.node-lead {
  left: 112px;
  top: 22px;
  color: #04a9c7;
}

.node-action {
  right: 34px;
  top: 58px;
  color: #8b61e8;
}

.node-report {
  right: 4px;
  bottom: 30px;
  color: #d68a00;
}

.node-crm {
  left: 166px;
  bottom: 28px;
  color: #16a36d;
}

.graph-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.trace-list {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.trace-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.trace-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
}

.trace-row div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.trace-row strong,
.trace-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-row em {
  color: #7c8da5;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.admin-command-panel {
  min-height: 180px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 28px 30px;
  margin-bottom: 18px;
  background:
    linear-gradient(115deg, rgba(211, 233, 253, .94), rgba(255, 255, 255, .96) 45%, rgba(255, 255, 255, .92));
}

.admin-command-panel > div:first-child {
  display: grid;
  gap: 12px;
}

.admin-command-panel h2 {
  font-size: 28px;
}

.admin-command-panel p {
  max-width: 720px;
  font-size: 16px;
}

.admin-command-stats {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  gap: 12px;
}

.admin-command-stats span {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-command-stats strong {
  color: var(--text-strong);
  font-size: 26px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  max-width: 100%;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: #536782;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-ok {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b9ebd3;
}

.status-warn {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #f4dfa6;
}

.status-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #ffc6bd;
}

.empty-state,
.error-state {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.empty-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  box-shadow: var(--shadow-tight);
}

.empty-state svg {
  color: var(--primary);
}

.empty-state strong {
  color: var(--text);
}

.error-state {
  margin: 12px 0;
  padding: 11px 13px;
  color: #9f2a21;
  background: #fff7f5;
  border-color: #ffd3cc;
  border-left-color: #e15b4f;
  border-left-width: 3px;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(280px, .85fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.overview-stack,
.personalization-panel {
  display: grid;
  gap: 14px;
}

.overview-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.channel-connect-card {
  display: grid;
  gap: 16px;
}

.channel-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}

.channel-card {
  position: relative;
  min-height: 166px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, var(--panel-muted));
  box-shadow: 0 10px 24px rgba(19, 49, 90, .06);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.channel-card:not(.disabled):hover {
  transform: translateY(-2px);
  border-color: var(--primary-line);
  box-shadow: 0 16px 32px rgba(19, 49, 90, .1);
}

.channel-card.connected {
  border-color: #bcebd8;
  background: linear-gradient(180deg, #ffffff, var(--green-soft));
}

.channel-card.disabled {
  color: var(--faint);
  background: #f8fbff;
}

.channel-card-status {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.channel-card-status.disconnected {
  color: var(--danger);
  border: 1px solid #ffc9c0;
  background: var(--danger-soft);
}

.channel-card-status.connected {
  color: var(--green);
  border: 1px solid #bcebd8;
  background: var(--green-soft);
}

.channel-card-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  color: #ffffff;
  border-radius: 12px;
  background: var(--text);
  box-shadow: 0 10px 20px rgba(19, 49, 90, .14);
}

.channel-card.connected .channel-card-icon {
  background: var(--primary);
}

.channel-card.disabled .channel-card-icon {
  color: #70839d;
  background: #e8eef7;
  box-shadow: none;
}

.channel-card h3 {
  margin: 0;
  padding-right: 26px;
  color: var(--text-strong);
  font-size: 14px;
  line-height: 1.3;
}

.channel-card p {
  min-height: 42px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.channel-card.disabled h3,
.channel-card.disabled p {
  color: #91a1b8;
}

.channel-card-action,
.channel-card-pill {
  min-height: 36px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}

.channel-card-action {
  color: #ffffff;
  border: 1px solid var(--primary);
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(37, 104, 199, .2);
  cursor: pointer;
}

.channel-card-action:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.channel-card-action:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.channel-card-pill {
  color: var(--muted);
  background: #e8eef7;
}

.channel-card-pill.connected {
  color: var(--green);
  background: var(--green-soft);
}

.channel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.test-pairing-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 14px;
  border: 1px solid rgba(35, 91, 255, .14);
  border-radius: 10px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 16px 38px rgba(25, 58, 120, .12);
}

.test-pairing-card img {
  width: 132px;
  height: 132px;
  border-radius: 8px;
  background: #fff;
}

.test-pairing-card strong {
  display: block;
  color: #10224a;
  font-size: 18px;
  line-height: 1.2;
}

.test-pairing-card p {
  max-width: 360px;
  margin: 8px 0;
  color: #50607d;
}

.test-pairing-card small {
  color: #75819b;
  font-weight: 700;
}

.muted-line {
  font-weight: 700;
}

.personalization-tabs {
  width: fit-content;
}

.personalization-grid {
  grid-template-columns: minmax(260px, .45fr) minmax(0, 1fr);
}

.editor-span {
  grid-column: auto;
}

.user-profile-editor textarea,
.editor-span textarea {
  min-height: 430px;
}

.readonly-block {
  padding: 16px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.readonly-block span {
  color: #2d405e;
  font-size: 13px;
  font-weight: 900;
}

.readonly-block pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.textarea-field {
  min-width: 0;
}

.resource-list {
  display: grid;
  gap: 10px;
}

.compact-list {
  margin-top: 14px;
}

.resource-item {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-tight);
}

.resource-item > div:first-child {
  min-width: 0;
}

.resource-item h2,
.resource-item p,
.resource-item small {
  overflow-wrap: anywhere;
}

.resource-item p {
  margin-top: 4px;
}

.resource-item small {
  display: block;
  margin-top: 6px;
}

.resource-actions,
.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.split-view {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 14px;
}

.list-panel {
  overflow: hidden;
}

.list-row {
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border-width: 0 0 1px;
  border-color: var(--border);
  border-radius: 0;
  background: #ffffff;
  color: var(--text);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  justify-items: start;
  text-align: left;
}

.list-row span,
.list-row small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row small {
  grid-column: 1;
}

.list-row svg {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--muted);
}

.list-row:hover,
.list-row[data-active="true"] {
  background: var(--primary-soft);
}

.detail-panel {
  min-height: 420px;
  padding: 14px;
  overflow: auto;
}

.message-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.message-row span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.message-row p {
  margin-top: 6px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.message-row small {
  display: block;
  margin-top: 6px;
}

.event-section {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.event-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-muted);
  padding: 12px;
}

.event-row span {
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.event-row p {
  margin-top: 6px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.event-row small {
  display: block;
  margin-top: 6px;
}

.inline-note {
  margin: -6px 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #654915;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-tight);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  overflow-wrap: anywhere;
}

tr:last-child td {
  border-bottom: 0;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #eef4fb;
}

.segmented-control button {
  min-height: 34px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.segmented-control button[data-active="true"] {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--border);
}

.model-select {
  max-width: 520px;
  margin-top: 14px;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.admin-form h2 {
  grid-column: 1 / -1;
}

.resource-form {
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
}

.settings-page {
  display: grid;
  gap: 18px;
}

.compact-action {
  min-height: 32px;
  padding: 0 12px;
  white-space: nowrap;
}

.search-box {
  min-height: 38px;
  min-width: min(100%, 240px);
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: #7d8da5;
  box-shadow: 0 5px 14px rgba(19, 49, 90, .04);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.search-box:focus-within {
  border-color: var(--primary-line);
  box-shadow: 0 0 0 3px rgba(37, 104, 199, .1);
}

.search-box input {
  min-height: 34px;
  padding: 0;
  border: 0;
  box-shadow: none;
  outline: 0;
}

.resource-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #ffffff;
}

.tone-orange { background: #ff7a1a; }
.tone-violet { background: #583df2; }
.tone-green { background: #2db84d; }
.tone-blue { background: #2f6df6; }
.tone-amber { background: #ffad1f; }
.tone-indigo { background: #4a50e8; }
.tone-cyan { background: #27b8d4; }

.agent-identity-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.agent-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #e8f2ff);
  color: var(--primary);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 900;
}

.agent-avatar.small {
  width: 34px;
  height: 34px;
}

.agent-identity-strip strong,
.chat-header strong {
  color: var(--text-strong);
  font-size: 14px;
}

.agent-identity-strip small,
.chat-header small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.tiny-icon-button,
.card-menu-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #66748a;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.tiny-icon-button:hover,
.card-menu-button:hover {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary);
}

.underline-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  border-bottom: 1px solid var(--border);
}

.underline-tabs button {
  min-height: 42px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #66748a;
  font-weight: 800;
}

.underline-tabs button[data-active="true"] {
  border-color: var(--text-strong);
  color: var(--text-strong);
}

.document-panel,
.workspace-reader,
.workspace-tree,
.model-radio-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-tight);
}

.document-toolbar,
.workspace-reader-head,
.modal-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 8px 8px 0 0;
}

.document-toolbar div,
.workspace-reader-head div {
  min-width: 0;
}

.document-toolbar span,
.workspace-reader-head span {
  color: #111827;
  font-size: 13px;
  font-weight: 900;
}

.document-toolbar small,
.workspace-reader-head small {
  margin-left: 12px;
  color: #7b8da7;
}

.document-actions {
  display: flex;
  gap: 8px;
}

.document-editor {
  padding: 14px;
}

.document-editor textarea {
  min-height: 500px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.markdown-document,
.workspace-document {
  min-height: 540px;
  max-height: calc(100vh - 270px);
  margin: 0;
  padding: 20px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #111827;
  background: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.75;
}

.management-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.soft-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: #eef2f7;
}

.soft-tabs button {
  min-height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #66748a;
  font-weight: 800;
}

.soft-tabs button[data-active="true"] {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 3px 10px rgba(19, 49, 90, .08);
}

.skill-card-grid,
.shop-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 24px;
}

.skill-card,
.shop-card {
  min-width: 0;
  min-height: 178px;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(19, 49, 90, .05);
  position: relative;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.skill-card:hover,
.shop-card:hover,
.tool-row:hover,
.tool-market-row:hover,
.model-row:hover,
.conversation-item:hover {
  border-color: var(--primary-line);
  box-shadow: 0 12px 26px rgba(19, 49, 90, .08);
}

.skill-card-head {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-right: 30px;
}

.skill-card h2,
.shop-card h2,
.tool-row h2,
.model-row h2 {
  margin: 0;
  color: #172033;
  font-size: 16px;
  line-height: 1.35;
}

.skill-card h2,
.skill-card p,
.shop-card h2,
.shop-card p,
.tool-row h2,
.tool-row p {
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-card-head span,
.tool-row h2 span,
.tool-market-row h3 span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 8px;
  padding: 0 5px;
  border-radius: 4px;
  background: #eef2f7;
  color: #66748a;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.skill-card p,
.shop-card p,
.tool-row p,
.tool-market-row p,
.model-row p {
  color: #66748a;
  font-size: 14px;
}

.card-menu-button {
  position: absolute;
  top: 16px;
  right: 16px;
}

.skill-card-state {
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: #66748a;
  font-size: 12px;
  font-weight: 900;
}

.skill-shop-page {
  max-width: 1022px;
  margin: 0 auto;
  display: grid;
  gap: 28px;
}

.shop-back-button {
  justify-self: start;
}

.skill-shop-hero {
  display: grid;
  justify-items: center;
  gap: 24px;
  padding-top: 2px;
  background-image: radial-gradient(#d9e1ec 1px, transparent 1px);
  background-size: 14px 14px;
}

.skill-shop-hero h1 {
  font-size: 28px;
}

.hero-shop-search {
  width: min(444px, 100%);
}

.skill-shop-banners {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.shop-banner {
  min-height: 182px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.shop-banner h2 {
  font-size: 20px;
  color: #1762d8;
}

.shop-banner p {
  max-width: 350px;
  margin-top: 12px;
}

.shop-banner span,
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 18px;
  color: #111827;
  font-weight: 900;
}

.banner-light {
  background: linear-gradient(115deg, #edf5ff, #ffffff);
}

.banner-dark {
  color: #ffffff;
  background:
    radial-gradient(circle at 70% 40%, rgba(89, 128, 255, .62), transparent 32%),
    linear-gradient(135deg, #12295f, #071534);
}

.banner-dark h2,
.banner-dark p,
.banner-dark span {
  color: #ffffff;
}

.shop-section-title {
  margin-bottom: -8px;
}

.text-button {
  min-height: 30px;
  margin: 0;
  border: 0;
  background: transparent;
  color: #55657b;
  font-size: 13px;
}

.text-button:hover {
  color: var(--primary);
}

.shop-card {
  min-height: 194px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-list span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border-radius: 4px;
  background: #eef2f7;
  color: #66748a;
  font-size: 12px;
  font-weight: 800;
}

.tool-toolbar {
  justify-content: flex-start;
}

.tool-toolbar .search-box {
  width: 260px;
}

.select-chip {
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(58px, auto) 14px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: #66748a;
  position: relative;
}

.select-chip span {
  font-size: 13px;
  font-weight: 800;
}

.select-chip select {
  min-height: 34px;
  padding: 0 16px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #172033;
  appearance: none;
}

.select-chip svg {
  pointer-events: none;
}

.tool-row-list {
  display: grid;
  gap: 14px;
}

.tool-row,
.tool-market-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.tool-row[data-active="true"]:first-child,
.tool-market-row[data-added="true"] {
  background: #eef0f2;
}

.switch-button {
  width: 28px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #bcd0ff;
  position: relative;
  transition: background-color 180ms ease;
}

.switch-button span {
  width: 12px;
  height: 12px;
  position: absolute;
  top: 2px;
  left: 2px;
  border-radius: 999px;
  background: #ffffff;
  transition: transform 180ms ease;
}

.switch-button[aria-checked="true"] {
  background: #1d5be3;
}

.switch-button[aria-checked="true"] span {
  transform: translateX(12px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: start;
  justify-items: center;
  padding-top: min(11vh, 100px);
  background: rgba(10, 15, 23, .55);
  animation: modalFadeIn 180ms ease both;
}

.tool-market-modal {
  width: min(680px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 120px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  padding: 0 16px 16px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .28);
  overflow: hidden;
}

.tool-market-modal .modal-head {
  margin: 0 -16px;
}

.tool-market-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 6px;
}

.tool-market-row h3 {
  margin: 0;
  color: #172033;
  font-size: 15px;
}

.conversation-layout {
  display: grid;
  grid-template-columns: minmax(240px, 250px) minmax(0, 1fr);
  min-height: calc(100vh - 166px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-tight);
  overflow: hidden;
}

.conversation-sidebar {
  border-right: 1px solid var(--border);
  background: #fbfcfe;
}

.conversation-item {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-content: center;
  justify-items: start;
  gap: 3px 10px;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: #172033;
  text-align: left;
}

.conversation-item[data-active="true"] {
  background: var(--primary-soft);
}

.conversation-item span,
.conversation-item small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item small {
  grid-column: 1;
  color: #7b8da7;
}

.conversation-item svg {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: #8a99ad;
}

.chat-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #ffffff;
}

.chat-header {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--border);
}

.chat-timeline {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 28px clamp(22px, 9vw, 190px);
  overflow: auto;
}

.chat-message {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.chat-message.user {
  justify-items: end;
}

.message-bubble {
  max-width: min(650px, 86%);
  padding: 12px 14px;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
}

.chat-message.user .message-bubble {
  background: #eef3ff;
}

.chat-message.system .message-bubble {
  border: 1px solid var(--border);
  background: #f8fafc;
}

.message-bubble span {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.message-bubble p {
  color: #172033;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-message small {
  color: #7b8da7;
}

.chat-events {
  margin: 0;
  padding: 0 28px 24px;
}

.workspace-browser {
  min-height: calc(100vh - 166px);
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-tight);
  overflow: hidden;
}

.workspace-tree {
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  padding: 14px 12px;
}

.workspace-tree h2 {
  margin-bottom: 12px;
}

.workspace-tree .search-box {
  margin-bottom: 14px;
}

.workspace-file-tree {
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: 0;
  overflow: auto;
}

.workspace-tree-row {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 16px 18px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding-block: 5px;
  padding-right: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #374151;
  text-align: left;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.workspace-tree-row:hover {
  background: #f3f7fc;
  border-color: #e1eaf5;
}

.workspace-file-row[data-active="true"] {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary);
}

.workspace-tree-caret {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  color: #8796aa;
}

.workspace-directory-row {
  font-weight: 850;
}

.workspace-directory-row[aria-expanded="true"] {
  color: #172033;
  background: #f8fbff;
}

.workspace-tree-label,
.workspace-file-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-file-row small {
  grid-column: 3;
  color: #8a99ad;
  font-size: 11px;
}

.workspace-tree-group {
  display: grid;
  gap: 2px;
}

.workspace-tree-status {
  min-height: 30px;
  display: flex;
  align-items: center;
  color: #8a99ad;
  font-size: 12px;
  font-weight: 750;
}

.workspace-reader {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.workspace-document {
  max-height: calc(100vh - 210px);
}

.workspace-empty-panel {
  min-height: calc(100vh - 210px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  background: #ffffff;
  color: #7b8da7;
  text-align: center;
}

.workspace-empty-panel svg {
  color: var(--primary);
}

.workspace-empty-panel h2 {
  font-size: 18px;
}

.workspace-empty-panel p {
  font-size: 14px;
}

.model-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-custom-button {
  position: relative;
  padding-right: 18px;
}

.model-custom-button span {
  position: absolute;
  top: -12px;
  right: -8px;
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid #ffd49a;
  border-radius: 999px;
  background: #fff4dd;
  color: #e27700;
  font-size: 11px;
  font-weight: 900;
}

.model-management-page {
  max-width: 1032px;
}

.model-radio-list {
  display: grid;
  gap: 2px;
  padding: 16px 8px;
}

.model-group-label {
  padding: 8px 12px 10px;
  color: #7b8da7;
  font-size: 13px;
  font-weight: 800;
}

.model-row {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 22px 44px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  text-align: left;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.model-row[data-active="true"] {
  background: #eef0f2;
}

.radio-dot {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid #a8b5c8;
  border-radius: 999px;
}

.model-row[data-active="true"] .radio-dot {
  border: 5px solid var(--primary);
}

.model-logo {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 1120px) {
  .skill-card-grid,
  .shop-card-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .chat-timeline {
    padding-inline: 32px;
  }
}

@media (max-width: 760px) {
  .management-toolbar,
  .tool-toolbar,
  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .skill-card-grid,
  .shop-card-grid,
  .skill-shop-banners,
  .conversation-layout,
  .workspace-browser {
    grid-template-columns: 1fr;
  }

  .conversation-sidebar,
  .workspace-tree {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .tool-row,
  .tool-market-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .tool-row .switch-button,
  .tool-market-row .compact-action {
    grid-column: 2;
    justify-self: start;
  }

  .model-row {
    grid-template-columns: 20px 34px minmax(0, 1fr);
    padding-inline: 10px;
  }
}

@keyframes networkClusterFloat {
  0% {
    transform: translate3d(-12px, 8px, 0);
    opacity: .56;
  }
  55% {
    opacity: .84;
  }
  100% {
    transform: translate3d(14px, -12px, 0);
    opacity: .64;
  }
}

@keyframes networkDash {
  0% {
    stroke-dashoffset: 36;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes networkPulse {
  0%,
  100% {
    opacity: .42;
    r: 2.6px;
  }
  50% {
    opacity: .9;
    r: 3.8px;
  }
}

@keyframes loginStageIn {
  0% {
    opacity: 0;
    filter: saturate(.92);
  }
  100% {
    opacity: 1;
    filter: saturate(1);
  }
}

@keyframes loginNetworkIn {
  0% {
    opacity: 0;
    transform: scale(1.015);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes loginItemRise {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loginCardIn {
  0% {
    opacity: 0;
    transform: translateX(18px) translateY(8px);
    box-shadow: 0 12px 34px rgba(11, 43, 83, .08);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0);
    box-shadow: 0 28px 70px rgba(11, 43, 83, .12);
  }
}

@keyframes processFlow {
  0% {
    background-position: 0 0, 120% 0;
  }
  100% {
    background-position: 0 0, -120% 0;
  }
}

@keyframes pageTransitionIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }

  .login-shell,
  .login-network,
  .login-story > *,
  .login-card,
  .page-transition {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

@media (max-width: 1120px) {
  .login-shell {
    grid-template-columns: minmax(520px, 1fr) minmax(440px, 40vw);
    gap: 0;
  }

  .login-shell::before,
  .login-network {
    inset: 0 max(440px, 40vw) 0 0;
  }

  .login-story {
    padding: 30px;
  }

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

  .workspace-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 0;
  }

  .admin-command-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .login-shell {
    height: auto;
    min-height: 100svh;
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 28px;
    overflow: auto;
    background: #f6faff;
  }

  .login-shell::before,
  .login-network {
    inset: 0;
  }

  .login-network {
    opacity: .58;
  }

  .login-story {
    padding: 0;
  }

  .login-copy h1 {
    font-size: 44px;
  }

  .login-copy p {
    font-size: 17px;
  }

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

  .process-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .process-step::after,
  .process-line {
    display: none;
  }

  .login-card {
    width: min(100%, 520px);
    max-width: 520px;
    justify-self: center;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }

  .sidebar-brand {
    padding-bottom: 12px;
  }

  .sidebar-label {
    margin-top: 12px;
  }

  .sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-button {
    width: auto;
    min-width: 112px;
    flex: 0 0 auto;
  }

  .nav-button[data-active="true"]::before {
    display: none;
  }

  .app-main {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .app-topbar {
    min-height: 62px;
    grid-template-columns: auto;
    justify-content: end;
    padding: 10px 14px;
  }

  .app-content {
    padding: 22px 16px 34px;
  }

  .page-header,
  .resource-item {
    flex-direction: column;
    align-items: stretch;
  }

  .metric-grid,
  .settings-grid,
  .split-view,
  .admin-form,
  .resource-form,
  .workspace-side {
    grid-template-columns: 1fr;
  }

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

  .topbar-actions .status-badge {
    display: none;
  }
}

@media (max-width: 560px) {
  .login-shell,
  .gate-page {
    padding: 18px;
  }

  .login-card,
  .gate-state {
    width: 100%;
    padding: 22px;
  }

  .login-copy h1 {
    font-size: 36px;
  }

  .login-brand-mark .login-wordmark {
    width: 100%;
  }

  .login-brand-mark {
    width: min(260px, 74vw);
    height: 62px;
  }

  .login-proof {
    grid-template-columns: 1fr;
  }

  .hero-search {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .hero-search .btn-primary {
    grid-column: 1 / -1;
    width: 100%;
  }

  .channel-card-grid {
    grid-template-columns: 1fr;
  }

  .gate-form,
  .resource-actions,
  .table-actions,
  .admin-command-stats,
  .test-pairing-card {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .test-pairing-card img {
    justify-self: center;
  }

  .compact-field,
  .btn-primary,
  .btn-secondary,
  .btn-table,
  .btn-danger {
    width: 100%;
  }

  .topbar-actions .user-chip {
    display: none;
  }
}
