:root {
  --bg: #efede8;
  --surface: #fffdf8;
  --soft: #f3eee4;
  --ink: #171512;
  --muted: #766f64;
  --line: #ddd3c2;
  --dark: #12100c;
  --dark-2: #1d1a15;
  --accent: #caa35a;
  --accent-dark: #8f6826;
  --gold: #c49b54;
  --blue: #807a6f;
  --green: #9a8556;
  --orange: #b88734;
  --purple: #7d7568;
  --gray: #726d63;
  --red: #bd4b43;
  --shadow: 0 22px 60px rgba(11, 21, 20, 0.1);
  --shadow-tight: 0 10px 30px rgba(11, 21, 20, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

html {
  background: var(--bg);
}

html:has(body[data-active-view="agents"]),
html:has(body[data-active-view="dashboard"]) {
  background: #090807;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 720px);
  justify-content: center;
  align-content: center;
  justify-items: center;
  gap: 46px;
  position: relative;
  overflow: hidden;
  padding: 64px 48px;
  background:
    linear-gradient(135deg, rgba(18, 16, 12, 0.98), rgba(36, 33, 28, 0.98)),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.075) 0, rgba(214, 165, 78, 0.075) 1px, transparent 1px, transparent 82px),
    repeating-linear-gradient(0deg, rgba(176, 165, 145, 0.06) 0, rgba(176, 165, 145, 0.06) 1px, transparent 1px, transparent 82px);
  color: #f7f1e6;
}

.login-screen::before,
.login-screen::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.login-screen::before {
  inset: 0;
  background:
    linear-gradient(116deg, transparent 0 54%, rgba(214, 165, 78, 0.16) 54.2%, transparent 55%),
    linear-gradient(24deg, transparent 0 70%, rgba(142, 133, 117, 0.18) 70.2%, transparent 71%),
    linear-gradient(180deg, rgba(255, 251, 242, 0.07), transparent 22%, rgba(0, 0, 0, 0.22));
}

.login-screen::after {
  left: 8%;
  right: 8%;
  top: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(214, 165, 78, 0.44), rgba(150, 142, 126, 0.22), transparent);
}

.login-copy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 22px;
  max-width: 720px;
  text-align: center;
}

.brand-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 26px;
  color: #f8f1e5;
}

.brand-line span,
.brand-block span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #d6a54e;
  color: #15211f;
  font-weight: 900;
  font-size: 20px;
}

.login-copy h1 {
  margin: 0;
  max-width: 720px;
  font-size: 66px;
  line-height: 1;
  letter-spacing: 0;
  color: #f8f1e5;
  text-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

.login-title {
  display: block;
  white-space: nowrap;
}

.login-logo-image {
  width: 164px;
  height: 164px;
  display: block;
  object-fit: contain;
  filter:
    drop-shadow(0 26px 56px rgba(0, 0, 0, 0.38))
    drop-shadow(0 0 30px rgba(214, 165, 78, 0.16));
}

.login-logo-emblem {
  position: relative;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(240, 198, 72, 0.28);
  border-radius: 30px;
  background:
    radial-gradient(circle at 68% 28%, rgba(240, 198, 72, 0.2), transparent 24%),
    linear-gradient(145deg, rgba(240, 198, 72, 0.15), rgba(255, 255, 255, 0.035) 48%, rgba(16, 14, 10, 0.54));
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.32),
    0 0 52px rgba(214, 165, 78, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.login-logo-emblem::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, transparent 0 52%, rgba(240, 198, 72, 0.17) 52.5%, transparent 54%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.08), transparent 42%);
  opacity: 0.9;
}

.logo-corner {
  position: absolute;
  left: 35px;
  top: 33px;
  z-index: 1;
  width: 42px;
  height: 52px;
  border-left: 12px solid #f0c648;
  border-bottom: 12px solid #f0c648;
  border-radius: 3px 0 4px 4px;
  transform: skewX(-8deg);
  box-shadow: -10px 16px 28px rgba(240, 198, 72, 0.14);
}

.logo-dot {
  position: absolute;
  right: 34px;
  top: 35px;
  z-index: 1;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #f0c648;
  box-shadow:
    0 0 0 8px rgba(240, 198, 72, 0.08),
    0 0 30px rgba(240, 198, 72, 0.52);
}

.logo-ray {
  position: absolute;
  left: 29px;
  bottom: 29px;
  width: 72px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(240, 198, 72, 0), rgba(240, 198, 72, 0.8), rgba(240, 198, 72, 0));
  transform: rotate(-28deg);
  transform-origin: left center;
  opacity: 0.72;
}

.login-copy p {
  margin: 0;
}

.login-kicker {
  color: rgba(214, 165, 78, 0.9);
  font-size: 12px;
  font-weight: 900;
}

.login-subtitle {
  margin-top: 20px !important;
  color: #d6a54e;
  font-size: 24px;
  font-weight: 800;
}

.login-metrics {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 34px;
}

.login-metrics article {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.login-metrics span {
  color: rgba(218, 232, 230, 0.7);
  font-size: 12px;
}

.login-metrics strong {
  color: #f8f1e5;
  font-size: 28px;
  line-height: 1;
}

.login-panel-kicker {
  margin: 0 0 8px;
  color: rgba(214, 165, 78, 0.86);
  font-size: 11px;
  font-weight: 900;
}

.login-panel p {
  margin: 0;
}

.login-panel label {
  color: rgba(232, 222, 203, 0.78);
}

.login-panel .primary-btn {
  min-height: 44px;
  margin-top: 4px;
}

.login-panel input {
  min-height: 44px;
  border-color: rgba(232, 222, 203, 0.18);
  background: rgba(18, 16, 12, 0.76);
  color: #f8f1e5;
}

.login-panel input::placeholder {
  color: rgba(232, 222, 203, 0.42);
}

.login-panel input:focus {
  border-color: rgba(214, 165, 78, 0.72);
  box-shadow: 0 0 0 3px rgba(214, 165, 78, 0.15);
}

.demo-accounts span {
  font-size: 13px;
}

.demo-login-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.demo-login-buttons button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--muted);
  font-size: 13px;
}

.login-panel,
.panel,
.metric-card,
.chat-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(408px, 100%);
  justify-self: center;
  display: grid;
  gap: 18px;
  padding: 32px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #f8f1e5;
  backdrop-filter: blur(22px);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
}

.login-panel h2 {
  margin: 0 0 6px;
  color: #f8f1e5;
  font-size: 28px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: 0;
  padding: 10px 11px;
}

textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(214, 165, 78, 0.14);
}

#loginError {
  margin: 0;
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #101614 0%, #18221f 100%);
  color: #f5fbf9;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.brand-block {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sidebar .brand-block > span {
  display: none !important;
}

.brand-block strong {
  display: block;
  font-size: 17px;
}

.brand-block p,
.eyebrow {
  margin: 4px 0 0;
  color: #8ea19b;
  font-size: 12px;
}

#mainNav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  min-height: 42px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ebe2d2;
  background: transparent;
  padding: 9px 11px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(214, 165, 78, 0.5);
}

.sidebar-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-card span {
  color: #b7ad9c;
  font-size: 12px;
}

.sidebar-card strong {
  display: block;
  margin-top: 7px;
}

.sidebar-card p {
  margin: 7px 0 0;
  color: #d4c8b5;
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 2px 0 0;
  font-size: 25px;
}

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

.primary-btn,
.secondary-btn,
.ghost-btn,
.ghost-dark-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
}

.primary-btn {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.secondary-btn {
  color: var(--accent-dark);
  background: #f1e7d5;
  border-color: #dfcfad;
}

.danger-btn {
  color: #9f382d;
  background: #fff4f1;
  border-color: rgba(181, 78, 64, 0.34);
}

.danger-btn:hover:not(:disabled) {
  background: #ffe6df;
  border-color: rgba(181, 78, 64, 0.72);
}

.ghost-btn {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.ghost-dark-btn {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.18);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.command-center {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(16, 22, 20, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #111a17 0%, #1e2c27 58%, #2b332c 100%);
  color: #f6fbf9;
  box-shadow: var(--shadow);
  padding: 22px;
  overflow: hidden;
}

.command-copy span {
  color: #d6a54e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.command-copy h3 {
  max-width: 720px;
  margin: 8px 0 10px;
  font-size: 30px;
  line-height: 1.15;
}

.command-copy p {
  max-width: 760px;
  margin: 0;
  color: #d0c5b4;
  line-height: 1.7;
}

.command-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.command-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  align-content: center;
}

.command-preview {
  align-self: stretch;
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid rgba(232, 222, 203, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
  padding: 14px;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.preview-head span {
  color: #d9b86c;
  font-size: 11px;
  font-weight: 900;
}

.preview-head strong {
  color: #f8f1e5;
  font-size: 15px;
}

.preview-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.preview-flow span {
  min-height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(232, 222, 203, 0.12);
  border-radius: 8px;
  background: rgba(18, 16, 12, 0.28);
  color: #d0c5b4;
  font-size: 12px;
  font-weight: 800;
}

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

.preview-grid article {
  min-height: 70px;
  border: 1px solid rgba(232, 222, 203, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  padding: 12px;
}

.preview-grid span,
.preview-queue p {
  color: #bdb29f;
  font-size: 12px;
}

.preview-grid strong {
  display: block;
  margin-top: 6px;
  color: #f8f1e5;
  font-size: 22px;
  line-height: 1.1;
}

.preview-queue {
  display: grid;
  gap: 8px;
}

.preview-queue article {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 10px;
  align-items: center;
  border-top: 1px solid rgba(232, 222, 203, 0.1);
  padding-top: 8px;
}

.preview-queue article > span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d9b86c;
  box-shadow: 0 0 16px rgba(214, 165, 78, 0.72);
}

.preview-queue strong {
  color: #f8f1e5;
  font-size: 13px;
}

.preview-queue p {
  margin: 3px 0 0;
}

.ops-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.ops-strip article {
  min-height: 102px;
  display: grid;
  align-content: center;
  gap: 10px;
  border: 1px solid rgba(221, 211, 194, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.92), rgba(246, 241, 232, 0.86));
  box-shadow: var(--shadow-tight);
  padding: 15px;
}

.ops-strip span {
  color: #8f6826;
  font-size: 11px;
  font-weight: 950;
}

.ops-strip strong {
  color: #211d16;
  font-size: 14px;
  line-height: 1.45;
}

.command-stats article {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  padding: 14px;
}

.command-stats span {
  display: block;
  color: #bdb29f;
  font-size: 12px;
}

.command-stats strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 24px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-agent-board {
  display: grid;
  gap: 14px;
}

.dashboard-module-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 10px;
}

.dashboard-module-tab {
  min-width: 0;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(221, 211, 194, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  text-align: left;
  box-shadow: 0 10px 24px rgba(23, 33, 31, 0.04);
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.dashboard-module-tab:hover,
.dashboard-module-tab.active {
  border-color: rgba(196, 155, 84, 0.86);
  background: #fbf5e9;
  transform: translateY(-1px);
}

.dashboard-module-tab strong {
  overflow: hidden;
  color: #171512;
  font-size: 14px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-module-tab em {
  align-self: start;
  border-radius: 999px;
  background: #171512;
  color: #f7f1e6;
  padding: 3px 7px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.module-avatar.mini {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 15px;
}

.dashboard-agent-section {
  min-width: 0;
  border: 1px solid rgba(221, 211, 194, 0.96);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(246, 241, 232, 0.92));
  box-shadow: var(--shadow-tight);
  padding: 14px;
}

.dashboard-agent-focus {
  min-height: 430px;
}

.dashboard-agent-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.dashboard-module-arrows {
  display: flex;
  gap: 8px;
}

.dashboard-agent-section-head strong {
  display: block;
  color: #171512;
  font-size: 18px;
  line-height: 1.2;
}

.dashboard-agent-section-head small {
  display: block;
  margin-top: 3px;
  color: #8f6826;
  font-size: 11px;
  font-weight: 900;
}

.dashboard-agent-section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.dashboard-agent-list {
  display: grid;
  gap: 8px;
}

.dashboard-agent-entry {
  width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(221, 211, 194, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.dashboard-agent-entry:hover {
  border-color: rgba(196, 155, 84, 0.68);
  box-shadow: 0 16px 34px rgba(143, 104, 38, 0.12);
  transform: translateY(-1px);
}

.dashboard-agent-entry strong {
  display: block;
  color: #171512;
  font-size: 14px;
  line-height: 1.28;
}

.dashboard-agent-entry p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-agent-entry em {
  align-self: start;
  border-radius: 999px;
  background: #f2eadb;
  color: var(--accent-dark);
  padding: 4px 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.module-card {
  min-height: 132px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 10px 26px rgba(23, 33, 31, 0.06);
}

.module-head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 11px;
  align-items: center;
}

.module-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #12100c;
  background: #d9b86c;
  font-size: 18px;
  font-weight: 950;
}

.module-card strong {
  display: block;
  color: #101819;
  font-size: 17px;
  line-height: 1.25;
}

.module-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.module-count {
  display: inline-flex;
  margin-top: 8px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #12100c;
  background: rgba(214, 165, 78, 0.1);
  font-size: 12px;
  font-weight: 900;
}

.module-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-module-tab .module-avatar,
.dashboard-agent-section-head > .module-avatar,
.dashboard-agent-entry > .agent-icon {
  display: none !important;
}

.tone-gold .module-avatar { background: linear-gradient(180deg, #f0cf83, #c49b54); }
.tone-green .module-avatar { background: linear-gradient(180deg, #d8bd7c, #9a8556); color: #201a12; }
.tone-blue .module-avatar { background: linear-gradient(180deg, #aaa295, #807a6f); color: #171512; }
.tone-teal .module-avatar { background: linear-gradient(180deg, #d6ad62, #caa35a); color: #201a12; }
.tone-orange .module-avatar { background: linear-gradient(180deg, #d6a45f, #b88734); color: #201a12; }
.tone-gray .module-avatar { background: linear-gradient(180deg, #a9a196, #726d63); color: #171512; }
.tone-purple .module-avatar { background: linear-gradient(180deg, #a89f90, #7d7568); color: #171512; }
.tone-black .module-avatar { background: linear-gradient(180deg, #3a352d, #1d1a15); color: #f8f1e5; }

.metric-card {
  min-height: 126px;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(23, 33, 31, 0.06);
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--accent-dark);
  font-size: 28px;
  line-height: 1.1;
}

.metric-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-grid,
.context-layout,
.usage-layout,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 14px;
}

.context-rules-panel {
  grid-column: 1 / -1;
}

#settingsView .settings-grid {
  grid-template-columns: minmax(0, 1fr);
}

.settings-tabs {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  gap: 6px;
  border: 1px solid rgba(196, 155, 84, 0.24);
  border-radius: 10px;
  background: rgba(18, 16, 12, 0.86);
  padding: 6px;
}

.settings-tabs button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(248, 241, 229, 0.72);
  padding: 0 18px;
  font-weight: 900;
}

.settings-tabs button.active {
  border-color: rgba(196, 155, 84, 0.5);
  background: linear-gradient(180deg, rgba(214, 165, 78, 0.95), rgba(143, 104, 38, 0.94));
  color: #fff8e9;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.context-rule-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.context-rule-grid article {
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 13px;
}

.context-rule-grid span {
  display: inline-flex;
  border-radius: 999px;
  background: #f2eadb;
  color: var(--accent-dark);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.context-rule-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.context-rule-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.panel {
  min-width: 0;
  padding: 16px;
  box-shadow: 0 12px 32px rgba(23, 33, 31, 0.07);
}

.panel-header {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header h3 {
  margin: 0;
  font-size: 16px;
}

.workflow-list,
.run-list,
.customer-list,
.policy-list,
.usage-user-list,
.usage-agent-list,
.usage-run-list {
  display: grid;
  gap: 10px;
}

.workflow-item,
.run-item,
.customer-item,
.policy-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 12px;
}

.workflow-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
}

.workflow-item span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-dark);
  background: #f1e7d5;
  font-weight: 800;
}

.workflow-item strong,
.run-item strong,
.customer-item strong,
.policy-list strong {
  display: block;
  font-size: 14px;
}

.workflow-item p,
.run-item p,
.customer-item p,
.policy-list p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.agents-layout {
  display: block;
}

#agentsView.active {
  height: calc(100vh - 148px);
  min-height: 620px;
}

#agentsView .agents-layout,
#agentsView .chat-panel,
#agentsView .chat-workspace {
  height: 100%;
  min-height: 0;
}

.agent-catalog {
  display: grid;
  gap: 12px;
}

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

.agent-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 206px);
  overflow: auto;
  padding: 2px 4px 2px 2px;
}

.agent-card {
  width: 100%;
  min-height: 118px;
  flex: 0 0 auto;
  text-align: left;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.agent-card.active {
  border-color: var(--accent);
  background: #eef8f5;
  transform: translateY(-1px);
}

.agent-icon,
.agent-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

.agent-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.agent-card p {
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
  overflow: visible;
}

.agent-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.agent-meta span,
.pill {
  border-radius: 999px;
  padding: 4px 8px;
  background: #f2eadb;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.chat-panel {
  min-height: calc(100vh - 118px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.conversation-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.conversation-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-right: 1px solid rgba(214, 165, 78, 0.18);
  background:
    linear-gradient(180deg, #080807, #11100d),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.06) 0, rgba(214, 165, 78, 0.06) 1px, transparent 1px, transparent 58px);
  color: #f8f1e5;
}

.conversation-sidebar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
}

.conversation-sidebar-head span {
  display: block;
  color: rgba(214, 165, 78, 0.88);
  font-size: 12px;
  font-weight: 900;
}

.conversation-sidebar-head strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #f8f1e5;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(214, 165, 78, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f1d49b;
  font-size: 22px;
  font-weight: 900;
}

.icon-btn:hover {
  border-color: rgba(214, 165, 78, 0.55);
  background: rgba(214, 165, 78, 0.12);
}

.conversation-new-btn {
  min-height: 40px;
  border: 1px solid rgba(214, 165, 78, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8f1e5;
  font-weight: 850;
  text-align: left;
  padding: 9px 11px;
}

.conversation-new-btn:hover {
  background: rgba(214, 165, 78, 0.16);
}

.conversation-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.conversation-item {
  width: 100%;
  display: grid;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(248, 241, 229, 0.86);
  padding: 10px;
  text-align: left;
}

.conversation-item:hover,
.conversation-item.active {
  border-color: rgba(214, 165, 78, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.conversation-item.active {
  box-shadow: inset 3px 0 0 #d6a54e;
}

.conversation-item strong {
  overflow: hidden;
  color: #f8f1e5;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item small {
  color: rgba(214, 165, 78, 0.72);
  font-size: 11px;
  font-weight: 900;
}

.conversation-item p {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: rgba(232, 222, 203, 0.62);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.conversation-item span {
  color: rgba(214, 165, 78, 0.72);
  font-size: 11px;
  font-weight: 800;
}

.conversation-empty {
  border: 1px dashed rgba(214, 165, 78, 0.24);
  border-radius: 8px;
  padding: 12px;
  color: rgba(248, 241, 229, 0.78);
}

.conversation-empty strong {
  display: block;
  font-size: 13px;
}

.conversation-empty p {
  margin: 6px 0 0;
  color: rgba(232, 222, 203, 0.58);
  font-size: 12px;
  line-height: 1.45;
}

.chat-workspace.conversation-collapsed {
  grid-template-columns: 56px minmax(0, 1fr);
}

.chat-workspace.conversation-collapsed .conversation-sidebar {
  align-items: center;
  padding: 12px 8px;
}

.chat-workspace.conversation-collapsed .conversation-sidebar-head {
  display: block;
}

.chat-workspace.conversation-collapsed .conversation-sidebar-head div,
.chat-workspace.conversation-collapsed .conversation-new-btn,
.chat-workspace.conversation-collapsed .conversation-list {
  display: none;
}

.agent-switcher {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(246, 241, 232, 0.94));
}

.agent-switcher label {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.agent-switcher select {
  min-height: 42px;
  background: #fffaf0;
  color: #211b12;
  font-weight: 800;
}

.agent-switcher-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 42px;
}

.agent-switcher-meta span {
  border: 1px solid rgba(196, 155, 84, 0.22);
  border-radius: 999px;
  background: rgba(242, 234, 219, 0.82);
  color: var(--accent-dark);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.chat-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 300px);
  gap: 12px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

#activeAgentIcon {
  display: none !important;
}

.chat-header h3 {
  margin: 0;
  font-size: 18px;
}

.chat-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-agent-title {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(180px, 0.56fr) minmax(320px, 0.88fr);
  align-items: end;
  gap: 14px;
}

.header-agent-picker {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(130px, 0.72fr) minmax(180px, 1fr);
  gap: 8px;
}

.header-agent-picker label {
  min-width: 0;
  gap: 6px;
  color: rgba(248, 241, 229, 0.74);
  font-size: 12px;
  font-weight: 800;
}

.header-agent-picker select {
  min-height: 38px;
  border-color: rgba(214, 165, 78, 0.32);
  background: rgba(18, 16, 12, 0.78);
  color: #f8f1e5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.chat-model-picker {
  justify-self: end;
  width: min(300px, 100%);
  gap: 6px;
  color: rgba(248, 241, 229, 0.74);
  font-size: 12px;
  font-weight: 800;
}

.chat-model-picker span {
  letter-spacing: 0;
}

.chat-model-picker select {
  min-height: 38px;
  border-color: rgba(214, 165, 78, 0.32);
  background: rgba(18, 16, 12, 0.78);
  color: #f8f1e5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.context-box {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.conversation-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.94);
}

.conversation-toolbar label {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.conversation-toolbar select {
  min-height: 38px;
  background: #fffaf0;
}

.context-box-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.context-box-title span {
  border-radius: 999px;
  background: #f2eadb;
  color: var(--accent-dark);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
}

.context-box-title strong {
  color: var(--ink);
  font-size: 14px;
}

.context-box p {
  margin: 0;
}

.chat-body {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  padding: 18px 20px;
  background:
    linear-gradient(180deg, #f8faf9 0%, #eef3f1 100%);
}

.message {
  max-width: min(760px, 86%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff;
  line-height: 1.68;
}

.message.user {
  justify-self: end;
  max-width: min(620px, 72%);
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.message.agent {
  justify-self: start;
}

.message small {
  display: block;
  margin-bottom: 10px;
  opacity: 0.72;
  font-weight: 700;
}

.message-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.message-top small {
  margin: 0;
}

.message-top time {
  margin-left: 8px;
  color: inherit;
  opacity: 0.64;
  font-size: 12px;
  font-weight: 800;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-copy-btn {
  min-height: 28px;
  border: 1px solid rgba(118, 111, 100, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
}

.message-copy-btn:hover,
.message-copy-btn.copied {
  border-color: rgba(214, 165, 78, 0.42);
  background: #f2eadb;
  color: var(--accent-dark);
}

.message-copy-btn:disabled {
  cursor: default;
  opacity: 0;
}

.message-quote {
  border-left: 3px solid rgba(214, 165, 78, 0.66);
  border-radius: 8px;
  background: rgba(214, 165, 78, 0.1);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.message-quote span {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.message-quote p {
  margin: 0;
  color: inherit;
  opacity: 0.78;
  font-size: 13px;
  line-height: 1.45;
}

.quote-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  border-left: 3px solid rgba(214, 165, 78, 0.82);
  border-radius: 8px;
  background: rgba(214, 165, 78, 0.1);
  padding: 9px 10px;
}

.quote-composer span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 950;
}

.quote-composer p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-composer button {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(118, 111, 100, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-weight: 900;
}

.message-context-menu {
  position: fixed;
  z-index: 80;
  min-width: 128px;
  border: 1px solid rgba(214, 165, 78, 0.26);
  border-radius: 8px;
  background: rgba(18, 16, 12, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.message-context-menu button {
  width: 100%;
  display: block;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  background: transparent;
  color: #f8f1e5;
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
}

.message-context-menu button:hover {
  background: rgba(214, 165, 78, 0.14);
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
}

.thinking-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #d9b86c;
  animation: thinkingPulse 1s infinite ease-in-out;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes thinkingPulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.message-content {
  color: inherit;
  font-size: 14px;
}

.message-content h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

.message.user .message-content h4 {
  color: #fff;
}

.message-content p {
  margin: 0 0 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content hr {
  height: 1px;
  border: 0;
  margin: 14px 0;
  background: rgba(118, 111, 100, 0.18);
}

.message-list-line {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
}

.message-list-line span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(214, 165, 78, 0.14);
  color: #806025;
  font-size: 12px;
  font-weight: 900;
}

.message.user .message-list-line span {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.message-spacer {
  height: 6px;
}

.message-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(118, 111, 100, 0.18);
  color: rgba(118, 111, 100, 0.86);
  font-size: 12px;
  line-height: 1.5;
}

.composer {
  position: sticky;
  bottom: 0;
  z-index: 8;
  border-top: 1px solid var(--line);
  padding: 14px;
  background: #fff;
  box-shadow: 0 -18px 46px rgba(18, 16, 12, 0.08);
}

.composer.drag-over {
  outline: 2px solid rgba(196, 155, 84, 0.6);
  outline-offset: -6px;
  background: #fff8eb;
}

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

.attachment-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.composer-box {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(214, 165, 78, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 48px rgba(0, 0, 0, 0.16);
}

.composer-box textarea {
  min-height: 56px;
  border: 0;
  background: transparent;
  padding: 0;
  resize: none;
  box-shadow: none;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.composer-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.composer-tools span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-tool-btn,
.send-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  padding: 0;
}

.composer-tool-btn {
  border: 1px solid rgba(143, 104, 38, 0.2);
  background: rgba(255, 255, 255, 0.72);
  color: #8f6826;
  font-size: 18px;
}

.chat-upload-zone {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  border: 1px dashed rgba(143, 104, 38, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.96), rgba(242, 234, 219, 0.92));
  color: #2b261e;
  padding: 10px 12px;
  text-align: left;
}

.chat-upload-zone:hover,
.composer.drag-over .chat-upload-zone {
  border-color: rgba(196, 155, 84, 0.9);
  background: #fff4dc;
}

.chat-upload-zone > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #d9b86c, #a77c32);
  color: #171512;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.chat-upload-zone strong,
.chat-upload-zone small {
  display: block;
}

.chat-upload-zone strong {
  color: #181511;
  font-size: 14px;
}

.chat-upload-zone small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.attachment-card,
.message-attachments article {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(221, 211, 194, 0.95);
  border-radius: 8px;
  background: #fffaf0;
  padding: 8px;
}

.attachment-card img,
.message-attachments img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
  background: #eee3ce;
}

.attachment-card > span,
.message-attachments article > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #d9b86c, #a77c32);
  color: #171512;
  font-size: 12px;
  font-weight: 950;
}

.attachment-card strong,
.message-attachments strong {
  display: block;
  overflow: hidden;
  color: #201a12;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card p,
.message-attachments p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.attachment-card button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(143, 104, 38, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #8f6826;
  font-weight: 900;
}

.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.message-attachments article {
  grid-template-columns: 42px minmax(0, 1fr);
  background: rgba(255, 250, 240, 0.86);
}

.message-artifacts {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.artifact-card {
  max-width: 520px;
  border: 1px solid rgba(214, 165, 78, 0.26);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
  overflow: hidden;
}

.artifact-card.image-artifact {
  display: grid;
  grid-template-columns: minmax(180px, 0.82fr) minmax(180px, 1fr);
}

.artifact-card.image-artifact img {
  width: 100%;
  height: 220px;
  display: block;
  object-fit: cover;
  background: #eee3ce;
}

.artifact-card.file-artifact {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.artifact-card.file-artifact > span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #d9b86c, #a77c32);
  color: #171512;
  font-size: 13px;
  font-weight: 950;
}

.artifact-card > div {
  padding: 12px;
}

.artifact-card strong {
  display: block;
  color: #1f1a12;
  font-size: 14px;
  line-height: 1.35;
}

.artifact-card p {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.artifact-card a {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.wide {
  grid-column: 1 / -1;
}

.customer-item {
  cursor: pointer;
}

.customer-item.active {
  border-color: var(--accent);
  background: #fbf5e9;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
}

.data-table th {
  color: var(--muted);
  background: #f4f7f6;
  font-size: 12px;
}

.table-input,
.table-select {
  min-width: 100px;
  padding: 7px 8px;
  font-size: 13px;
}

.usage-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 0.8fr) minmax(240px, 1.2fr);
  gap: 10px;
}

.usage-user-card,
.usage-agent-item,
.usage-run-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 12px;
}

.usage-user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.usage-user-card strong,
.usage-agent-item strong,
.usage-run-item strong {
  display: block;
  font-size: 14px;
}

.usage-user-card p,
.usage-agent-item p,
.usage-run-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.usage-user-card > p {
  grid-column: 1 / -1;
}

.usage-user-card > span,
.usage-agent-item > span {
  align-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f2eadb;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.usage-user-card.active {
  border-color: var(--accent);
  background: #fbf5e9;
}

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

.usage-run-item {
  display: grid;
  gap: 9px;
}

.usage-run-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.usage-run-head span,
.usage-run-meta {
  color: var(--muted);
  font-size: 12px;
}

.usage-question,
.usage-answer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.usage-question span,
.usage-answer span {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.usage-conversation {
  border: 1px solid rgba(221, 211, 194, 0.95);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.72);
  padding: 10px;
}

.usage-conversation summary {
  cursor: pointer;
  color: #8f6826;
  font-size: 13px;
  font-weight: 900;
}

.usage-conversation-body {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.usage-message {
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.usage-message.user {
  background: rgba(214, 165, 78, 0.16);
}

.usage-message span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.usage-message p {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
}

.usage-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.usage-pagination small {
  color: var(--muted);
  font-size: 12px;
}

.usage-page-numbers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.usage-page-numbers span {
  color: var(--muted);
  font-size: 12px;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  border: 1px solid rgba(221, 211, 194, 0.95);
  border-radius: 8px;
  background: #fffaf0;
  color: #4a3c25;
  font-weight: 900;
}

.page-btn.active {
  border-color: rgba(196, 155, 84, 0.86);
  background: linear-gradient(180deg, #d9b86c, #a77c32);
  color: #171512;
}

.agent-knowledge-upload {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(221, 211, 194, 0.95);
  border-radius: 8px;
  background: #fffaf0;
  padding: 14px;
}

.agent-knowledge-upload strong {
  display: block;
  color: #171512;
  font-size: 14px;
}

.agent-knowledge-upload p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.agent-knowledge-upload input[type="file"] {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.78);
}

.settings-agent-manager {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
  gap: 14px;
  align-items: end;
  border: 1px solid rgba(221, 211, 194, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(246, 241, 232, 0.94));
  padding: 14px;
}

.settings-agent-manager strong {
  display: block;
  color: #171512;
  font-size: 15px;
}

.settings-agent-manager p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-agent-picker {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
}

.settings-agent-picker.single {
  grid-template-columns: minmax(0, 1fr);
}

.settings-agent-picker label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.settings-agent-picker select {
  min-height: 42px;
  background: #fff;
  color: #171512;
  font-weight: 800;
}

.settings-user-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.settings-user-list button {
  border: 1px solid rgba(196, 155, 84, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: #171512;
  padding: 12px;
  text-align: left;
}

.settings-user-list button.active {
  border-color: rgba(196, 155, 84, 0.75);
  background: #fff3d7;
}

.settings-user-list strong {
  font-size: 14px;
}

.settings-user-list span {
  display: inline-flex;
  margin-left: 6px;
  border-radius: 999px;
  background: #f2eadb;
  color: var(--accent-dark);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
}

.settings-user-list p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.model-config-note {
  margin-bottom: 14px;
  border: 1px solid rgba(196, 155, 84, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.82);
  color: var(--muted);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
}

.model-config-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 12px;
}

.settings-model-card {
  border: 1px solid rgba(196, 155, 84, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  padding: 14px;
}

.settings-model-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.settings-model-head strong {
  display: block;
  font-size: 15px;
}

.settings-model-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.settings-model-head span {
  align-self: flex-start;
  border-radius: 999px;
  background: #f2eadb;
  color: var(--accent-dark);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

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

.agent-knowledge-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-knowledge-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.agent-knowledge-list em {
  border-radius: 999px;
  background: #f2eadb;
  color: var(--accent-dark);
  padding: 5px 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.agent-knowledge-list.editable em {
  padding: 0;
  background: transparent;
}

.knowledge-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(196, 155, 84, 0.28);
  border-radius: 999px;
  background: #f2eadb;
  color: var(--accent-dark);
  padding: 5px 9px;
  cursor: pointer;
}

.knowledge-chip small {
  color: #8b6b2f;
  font-size: 11px;
  font-weight: 900;
}

.knowledge-chip:hover {
  border-color: rgba(196, 155, 84, 0.72);
  background: #fff3d7;
}

.agent-upload-progress {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(196, 155, 84, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 12px;
}

.agent-upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agent-upload-head strong {
  font-size: 13px;
}

.agent-upload-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.agent-upload-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee3ce;
}

.agent-upload-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d9b86c, #a77c32);
  transition: width 180ms ease;
}

.agent-upload-file-list {
  display: grid;
  gap: 8px;
}

.agent-upload-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(221, 211, 194, 0.95);
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px;
}

.agent-upload-file strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.agent-upload-file p {
  margin: 4px 0 0;
  font-size: 12px;
}

.agent-upload-file.ready {
  border-color: rgba(196, 155, 84, 0.32);
}

.agent-upload-file.uploading,
.agent-upload-file.reading {
  border-color: rgba(196, 155, 84, 0.62);
  background: #fff8e8;
}

.agent-upload-file.done {
  border-color: rgba(79, 140, 96, 0.34);
  background: #f6fbf5;
}

.agent-upload-file.failed {
  border-color: rgba(181, 78, 64, 0.42);
  background: #fff4f1;
}

.agent-upload-file.failed p {
  color: #9f382d;
}

.agent-upload-file-side {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.agent-upload-file-side span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.agent-upload-file-side button {
  border: 1px solid rgba(196, 155, 84, 0.28);
  border-radius: 999px;
  background: #f2eadb;
  color: var(--accent-dark);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.context-knowledge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.context-knowledge span {
  border-radius: 999px;
  background: #eee3ce;
  color: var(--accent-dark);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 900;
}

.context-knowledge strong {
  color: #3a3328;
  font-size: 13px;
  line-height: 1.45;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.72fr) minmax(540px, 1.28fr);
  gap: 14px;
  align-items: start;
}

#knowledgeView .toolbar {
  grid-template-columns: 1fr;
  margin-bottom: 12px;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.knowledge-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 248px);
  overflow: auto;
  padding: 2px 4px 2px 2px;
}

.knowledge-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(23, 33, 31, 0.05);
}

.knowledge-item.active {
  border-color: rgba(196, 155, 84, 0.78);
  background: linear-gradient(180deg, #fffaf0, #f6efe1);
  box-shadow: 0 18px 42px rgba(143, 104, 38, 0.12);
}

.knowledge-item strong {
  display: block;
  color: #181511;
  font-size: 14px;
  line-height: 1.35;
}

.knowledge-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.knowledge-item > span {
  justify-self: end;
  align-self: start;
  border-radius: 999px;
  background: #eee3ce;
  color: var(--accent-dark);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.knowledge-item small {
  grid-column: 1 / -1;
  color: #8c8273;
  font-size: 12px;
}

.upload-box {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  border: 1px solid rgba(214, 165, 78, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 250, 240, 0.95), rgba(241, 231, 213, 0.8));
  padding: 12px;
}

.upload-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.large-textarea {
  min-height: 280px;
}

.knowledge-bindings {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.panel-header.compact {
  min-height: 28px;
  margin-bottom: 10px;
}

.binding-list {
  display: grid;
  gap: 9px;
}

.binding-list article {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf7ef;
  padding: 10px;
}

.binding-list strong {
  display: block;
  font-size: 13px;
}

.binding-list p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.agent-icon.mini {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.empty-state {
  border: 1px dashed rgba(143, 104, 38, 0.32) !important;
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.78) !important;
  padding: 12px;
}

.empty-state strong {
  display: block;
  color: #2b261e;
  font-size: 14px;
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.knowledge-check-panel {
  display: grid;
  gap: 9px;
}

.knowledge-check-panel > span {
  color: var(--muted);
  font-size: 13px;
}

.knowledge-check-panel > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.knowledge-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 9px;
}

.knowledge-check {
  min-height: 92px;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 11px;
}

.knowledge-check input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
}

.knowledge-check strong,
.knowledge-check small {
  grid-column: 2;
}

.knowledge-check strong {
  color: #171512;
  font-size: 13px;
  line-height: 1.35;
}

.knowledge-check small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  border-radius: 8px;
  background: #14201d;
  color: #fff;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  font-size: 13px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Premium AI command skin */
body {
  position: relative;
  background:
    linear-gradient(180deg, rgba(246, 243, 237, 0.98), rgba(232, 226, 216, 0.96)),
    repeating-linear-gradient(90deg, rgba(72, 66, 56, 0.035) 0, rgba(72, 66, 56, 0.035) 1px, transparent 1px, transparent 72px),
    repeating-linear-gradient(0deg, rgba(72, 66, 56, 0.028) 0, rgba(72, 66, 56, 0.028) 1px, transparent 1px, transparent 72px);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    linear-gradient(115deg, transparent 0 58%, rgba(214, 165, 78, 0.1) 58%, transparent 59%),
    linear-gradient(22deg, transparent 0 68%, rgba(196, 155, 84, 0.11) 68%, transparent 69%);
}

.login-screen {
  background:
    linear-gradient(135deg, rgba(18, 16, 12, 0.98), rgba(38, 35, 30, 0.98)),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.075) 0, rgba(214, 165, 78, 0.075) 1px, transparent 1px, transparent 78px),
    repeating-linear-gradient(0deg, rgba(176, 165, 145, 0.06) 0, rgba(176, 165, 145, 0.06) 1px, transparent 1px, transparent 78px);
  color: #f7f1e6;
}

.login-panel {
  border-color: rgba(232, 222, 203, 0.16);
  background: rgba(45, 41, 34, 0.78);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
}

.login-panel input {
  border-color: rgba(232, 222, 203, 0.18);
  background: rgba(18, 16, 12, 0.76);
  color: #f8f1e5;
}

.app-shell {
  grid-template-columns: 304px minmax(0, 1fr);
}

.sidebar {
  position: relative;
  overflow: hidden;
  border-right: 1px solid rgba(214, 165, 78, 0.18);
  background:
    linear-gradient(180deg, #12100c 0%, #1b1813 52%, #11100d 100%),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.08) 0, rgba(214, 165, 78, 0.08) 1px, transparent 1px, transparent 60px);
  box-shadow: 22px 0 70px rgba(18, 16, 12, 0.18);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, transparent 0 34%, rgba(214, 165, 78, 0.15) 34%, transparent 35%),
    linear-gradient(45deg, transparent 0 72%, rgba(196, 155, 84, 0.12) 72%, transparent 73%);
  opacity: 0.82;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.brand-line span,
.brand-block span {
  background: linear-gradient(135deg, #d9b86c, #b88734);
  color: #12100c;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 14px 32px rgba(196, 155, 84, 0.28);
}

.brand-block strong {
  font-size: 18px;
}

.brand-block p,
.eyebrow {
  color: #9a907f;
  font-weight: 700;
}

.nav-btn {
  min-height: 46px;
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.025);
  color: #ebe2d2;
  font-weight: 700;
}

.nav-btn:hover {
  border-color: rgba(214, 165, 78, 0.35);
  background: rgba(214, 165, 78, 0.08);
}

.nav-btn.active {
  border-color: rgba(196, 155, 84, 0.7);
  background:
    linear-gradient(90deg, rgba(196, 155, 84, 0.2), rgba(214, 165, 78, 0.08)),
    rgba(255, 255, 255, 0.08);
  box-shadow: inset 3px 0 0 #c49b54, 0 12px 24px rgba(0, 0, 0, 0.12);
}

.sidebar-card {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.055));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.workspace {
  min-height: 100vh;
  padding: 26px;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  padding: 14px;
  border: 1px solid rgba(214, 224, 226, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 42px rgba(11, 21, 20, 0.08);
  backdrop-filter: blur(14px);
}

.topbar h2 {
  font-size: 26px;
  font-weight: 900;
}

input,
select,
textarea {
  border-color: #cfdcde;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(214, 165, 78, 0.82);
  box-shadow: 0 0 0 4px rgba(214, 165, 78, 0.12);
}

.primary-btn {
  background: linear-gradient(180deg, #d7b268, #8f6826);
  border-color: rgba(214, 165, 78, 0.72);
  box-shadow: 0 12px 24px rgba(143, 104, 38, 0.18);
  font-weight: 800;
}

.primary-btn:hover {
  background: linear-gradient(180deg, #e0be76, #7c5a24);
}

.secondary-btn {
  color: #2c261c;
  background: linear-gradient(180deg, #f6efe2, #eadabd);
  border-color: rgba(214, 165, 78, 0.26);
  font-weight: 800;
}

.ghost-btn {
  color: #242017;
  background: rgba(255, 255, 255, 0.88);
  border-color: #ddd3c2;
  font-weight: 800;
}

.ghost-dark-btn {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 800;
}

.command-center {
  position: relative;
  min-height: 210px;
  border-color: rgba(214, 165, 78, 0.28);
  background:
    linear-gradient(135deg, #12100c 0%, #1d1a15 56%, #28231b 100%),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.08) 0, rgba(214, 165, 78, 0.08) 1px, transparent 1px, transparent 58px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0, rgba(255, 255, 255, 0.045) 1px, transparent 1px, transparent 58px);
  box-shadow: 0 28px 80px rgba(18, 16, 12, 0.18);
}

.command-center::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(112deg, transparent 0 54%, rgba(214, 165, 78, 0.18) 54%, transparent 55%),
    linear-gradient(28deg, transparent 0 70%, rgba(196, 155, 84, 0.15) 70%, transparent 71%);
  opacity: 0.75;
}

.command-center::after {
  content: "";
  position: absolute;
  right: 11%;
  top: 0;
  width: 18%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(214, 165, 78, 0.12), transparent);
  transform: skewX(-18deg);
  opacity: 0.86;
}

.command-center > * {
  position: relative;
  z-index: 1;
}

.command-copy span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d9b86c;
}

.command-copy span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #caa35a;
  box-shadow: 0 0 18px rgba(214, 165, 78, 0.95);
}

.command-copy h3 {
  max-width: 820px;
  margin-top: 12px;
  color: #f8f1e5;
  font-size: 38px;
  font-weight: 950;
}

.command-copy h3 em {
  color: #d9b86c;
  font-style: normal;
  white-space: nowrap;
}

.command-stats article {
  border-color: rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.055));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.command-stats strong {
  color: #ffffff;
  font-size: 28px;
}

.metric-card,
.panel,
.chat-panel,
.module-card,
.agent-card,
.workflow-item,
.run-item,
.customer-item,
.usage-user-card,
.usage-agent-item,
.usage-run-item,
.usage-question,
.usage-answer,
.policy-list article,
.context-rule-grid article {
  border-color: rgba(205, 219, 222, 0.9);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-tight);
  backdrop-filter: blur(10px);
}

.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #caa35a, #c49b54);
}

.metric-card strong {
  color: #6f531f;
  font-weight: 950;
}

.module-card {
  position: relative;
  overflow: hidden;
  min-height: 154px;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.module-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
}

.module-card:hover,
.customer-item:hover {
  border-color: rgba(214, 165, 78, 0.42);
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(11, 21, 20, 0.12);
}

.agent-card:hover {
  border-color: rgba(214, 165, 78, 0.42);
  box-shadow: 0 18px 42px rgba(11, 21, 20, 0.12);
}

.module-card strong,
.panel-header h3,
.agent-card h3 {
  font-weight: 900;
}

.module-card .module-count {
  background: rgba(7, 16, 15, 0.92);
  color: #f7fcfb;
}

.module-card .module-avatar {
  box-shadow: 0 14px 28px rgba(11, 21, 20, 0.16);
}

.tone-gold::before { background: var(--gold); }
.tone-green::before { background: var(--green); }
.tone-blue::before { background: var(--blue); }
.tone-teal::before { background: var(--accent); }
.tone-orange::before { background: var(--orange); }
.tone-gray::before { background: var(--gray); }
.tone-purple::before { background: var(--purple); }
.tone-black::before { background: #202825; }

.workflow-item span {
  color: #201a12;
  background: linear-gradient(180deg, #d9b86c, #c49b54);
}

.context-rule-grid span,
.context-box-title span,
.agent-meta span,
.pill {
  background: rgba(214, 165, 78, 0.1);
  color: #806025;
}

.agent-card {
  position: relative;
  overflow: visible;
  grid-template-columns: 46px 1fr;
}

.agent-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
}

.agent-card.active {
  border-color: rgba(214, 165, 78, 0.62);
  background: linear-gradient(180deg, rgba(251, 245, 232, 0.98), rgba(255, 253, 248, 0.92));
  box-shadow: 0 22px 52px rgba(143, 104, 38, 0.14);
}

.agent-card.active::before {
  background: #caa35a;
}

.agent-icon,
.agent-avatar {
  width: 46px;
  height: 46px;
  background:
    linear-gradient(180deg, #d7b268, #8f6826);
  box-shadow: 0 12px 28px rgba(143, 104, 38, 0.22);
}

.chat-panel {
  overflow: hidden;
}

.chat-header {
  background:
    linear-gradient(135deg, #12100c, #1d1a15),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.08) 0, rgba(214, 165, 78, 0.08) 1px, transparent 1px, transparent 56px);
  color: #f8f1e5;
  border-bottom-color: rgba(214, 165, 78, 0.22);
}

.chat-header p {
  color: #b9ae9d;
}

.chat-header .pill {
  background: rgba(196, 155, 84, 0.18);
  color: #f1d49b;
}

.chat-header .chat-model-picker select {
  background: rgba(18, 16, 12, 0.82);
  color: #f1d49b;
}

.context-box {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(246, 241, 232, 0.96));
}

.chat-body {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.95), rgba(240, 235, 226, 0.95)),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.045) 0, rgba(214, 165, 78, 0.045) 1px, transparent 1px, transparent 46px);
}

.message {
  box-shadow: 0 10px 30px rgba(11, 21, 20, 0.07);
}

.message.agent {
  border-left: 3px solid rgba(214, 165, 78, 0.82);
}

.message.user {
  background:
    linear-gradient(180deg, #d7b268, #8f6826);
  box-shadow: 0 18px 36px rgba(143, 104, 38, 0.18);
}

.composer {
  background: rgba(255, 255, 255, 0.9);
}

.table-wrap {
  box-shadow: var(--shadow-tight);
}

.data-table th {
  background: #f1eadc;
  color: #6b6254;
}

.toast {
  background: #12100c;
  border: 1px solid rgba(214, 165, 78, 0.28);
}

body[data-active-view="dashboard"] {
  background: #090807;
  color: #f5f1e9;
  scrollbar-color: rgba(214, 165, 78, 0.35) #090807;
}

body[data-active-view="dashboard"]::before {
  display: none;
}

body[data-active-view="dashboard"] .app-shell,
body[data-active-view="dashboard"] .workspace,
body[data-active-view="dashboard"] #dashboardView,
body[data-active-view="dashboard"] .dashboard-agent-board {
  background: #090807;
}

body[data-active-view="dashboard"] .workspace {
  min-height: 100vh;
}

body[data-active-view="dashboard"] .topbar {
  border-color: rgba(214, 165, 78, 0.2);
  background:
    linear-gradient(180deg, rgba(18, 16, 12, 0.96), rgba(12, 11, 9, 0.96)),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.07) 0, rgba(214, 165, 78, 0.07) 1px, transparent 1px, transparent 74px);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.24);
}

body[data-active-view="dashboard"] .topbar .eyebrow {
  color: rgba(214, 165, 78, 0.8);
}

body[data-active-view="dashboard"] .topbar h2 {
  color: #f8f1e5;
}

body[data-active-view="dashboard"] .dashboard-module-tab,
body[data-active-view="dashboard"] .dashboard-agent-section,
body[data-active-view="dashboard"] .dashboard-agent-entry,
body[data-active-view="dashboard"] .empty-state {
  border-color: rgba(214, 165, 78, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035)),
    #0e0d0b;
  color: #f5f1e9;
  box-shadow: none;
}

body[data-active-view="dashboard"] .dashboard-module-tab:hover,
body[data-active-view="dashboard"] .dashboard-module-tab.active {
  border-color: rgba(214, 165, 78, 0.62);
  background:
    linear-gradient(180deg, rgba(214, 165, 78, 0.2), rgba(214, 165, 78, 0.08)),
    #15120e;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
}

body[data-active-view="dashboard"] .dashboard-module-tab strong,
body[data-active-view="dashboard"] .dashboard-agent-section-head strong,
body[data-active-view="dashboard"] .dashboard-agent-entry strong,
body[data-active-view="dashboard"] .empty-state strong {
  color: #f8f1e5;
}

body[data-active-view="dashboard"] .dashboard-module-tab em,
body[data-active-view="dashboard"] .dashboard-agent-entry em {
  background: rgba(214, 165, 78, 0.16);
  color: #e4c26f;
}

body[data-active-view="dashboard"] .dashboard-agent-section {
  background:
    linear-gradient(180deg, rgba(18, 16, 12, 0.98), rgba(9, 8, 7, 0.98)),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.045) 0, rgba(214, 165, 78, 0.045) 1px, transparent 1px, transparent 72px);
}

body[data-active-view="dashboard"] .dashboard-agent-section-head small {
  color: rgba(214, 165, 78, 0.86);
}

body[data-active-view="dashboard"] .dashboard-agent-section-head p,
body[data-active-view="dashboard"] .dashboard-agent-entry p,
body[data-active-view="dashboard"] .empty-state p {
  color: rgba(245, 241, 233, 0.62);
}

body[data-active-view="dashboard"] .dashboard-agent-entry:hover {
  border-color: rgba(214, 165, 78, 0.5);
  background:
    linear-gradient(180deg, rgba(214, 165, 78, 0.14), rgba(255, 255, 255, 0.045)),
    #15120e;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
}

body[data-active-view="dashboard"] .dashboard-module-arrows .icon-btn {
  border-color: rgba(214, 165, 78, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: #f8f1e5;
}

body[data-active-view="dashboard"] .dashboard-module-arrows .icon-btn:hover {
  border-color: rgba(214, 165, 78, 0.56);
  background: rgba(214, 165, 78, 0.16);
}

#agentsView .chat-body {
  padding: 28px 24px 30px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.98), rgba(8, 7, 6, 0.98)),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.055) 0, rgba(214, 165, 78, 0.055) 1px, transparent 1px, transparent 72px);
  color: #f5f1e9;
  gap: 24px;
}

body[data-active-view="agents"] .topbar,
body[data-active-view="agents"] .agent-switcher {
  display: none;
}

body[data-active-view="agents"] {
  background: #090807;
  overflow: hidden;
  scrollbar-color: rgba(214, 165, 78, 0.35) #090807;
}

body[data-active-view="agents"]::before {
  display: none;
}

body[data-active-view="agents"] .app-shell {
  background: #090807;
}

body[data-active-view="agents"] .workspace {
  min-height: 100vh;
  padding: 0;
  background: #090807;
  overflow: hidden;
}

body[data-active-view="agents"] #agentsView,
body[data-active-view="agents"] .agents-layout,
body[data-active-view="agents"] .chat-panel {
  height: 100vh;
  min-height: 100vh;
  background: #090807;
  border: 0;
  box-shadow: none;
}

body[data-active-view="agents"] .chat-panel {
  border: 0;
  border-radius: 0;
  background: #090807;
  box-shadow: none;
  overflow: hidden;
}

body[data-active-view="agents"] #agentsView.active {
  height: 100vh;
  min-height: 100vh;
}

body[data-active-view="agents"] .chat-workspace {
  height: 100%;
  background: #090807;
  border: 0;
}

body[data-active-view="agents"] .conversation-main {
  min-height: 0;
  background: #090807;
  border: 0;
}

body[data-active-view="agents"] #agentsView .chat-body {
  grid-template-columns: minmax(0, 920px);
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.98), rgba(8, 7, 6, 0.98)),
    repeating-linear-gradient(90deg, rgba(214, 165, 78, 0.055) 0, rgba(214, 165, 78, 0.055) 1px, transparent 1px, transparent 72px);
  scrollbar-color: rgba(214, 165, 78, 0.35) #090807;
}

body[data-active-view="agents"] #agentsView .chat-body::-webkit-scrollbar {
  width: 10px;
  background: #090807;
}

body[data-active-view="agents"] #agentsView .chat-body::-webkit-scrollbar-track {
  background: #090807;
}

body[data-active-view="agents"] #agentsView .chat-body::-webkit-scrollbar-thumb {
  background: rgba(214, 165, 78, 0.36);
  border: 2px solid #090807;
  border-radius: 999px;
}

#agentsView .composer {
  border-top-color: rgba(214, 165, 78, 0.2);
  background:
    linear-gradient(180deg, rgba(12, 11, 9, 0.98), rgba(18, 16, 12, 0.98));
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.2);
}

body[data-active-view="agents"] #runForm {
  display: grid;
  justify-items: center;
  padding: 12px 18px 14px;
}

body[data-active-view="agents"] #runForm > * {
  width: min(920px, 100%);
}

body[data-active-view="agents"] #taskInput {
  min-height: 56px;
  height: 56px;
  color: #f8f1e5;
}

body[data-active-view="agents"] #taskInput:focus {
  border-color: transparent;
  outline: 0;
  box-shadow: none;
}

body[data-active-view="agents"] #taskInput::placeholder {
  color: rgba(245, 241, 233, 0.48);
}

body[data-active-view="agents"] .composer-box {
  border-color: rgba(214, 165, 78, 0.28);
  background: rgba(255, 255, 255, 0.065);
}

body[data-active-view="agents"] .composer-tool-btn {
  border-color: rgba(214, 165, 78, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #f1d49b;
}

body[data-active-view="agents"] .composer-tools {
  color: rgba(245, 241, 233, 0.56);
}

#agentsView .message {
  grid-column: 1;
  width: 100%;
  max-width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #f5f1e9;
  padding: 0;
}

#agentsView .message.user {
  justify-self: end;
  width: auto;
  max-width: min(680px, 76%);
  border-radius: 24px;
  background: #2d2d2d;
  color: #f7f7f7;
  padding: 18px 22px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

#agentsView .message.agent {
  justify-self: stretch;
}

body[data-active-view="agents"] #agentsView .message small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(245, 241, 233, 0.58);
}

#agentsView .message-top {
  justify-content: space-between;
  margin-bottom: 12px;
}

body[data-active-view="agents"] #agentsView .message.user .message-top {
  justify-content: flex-end;
}

body[data-active-view="agents"] #agentsView .message.user small {
  color: rgba(255, 255, 255, 0.62);
}

#agentsView .message-copy-btn {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 241, 233, 0.64);
}

#agentsView .message-copy-btn:hover,
#agentsView .message-copy-btn.copied {
  border-color: rgba(214, 165, 78, 0.48);
  background: rgba(214, 165, 78, 0.15);
  color: #f1d49b;
}

#agentsView .message.user .message-top {
  margin: -4px 0 8px;
}

body[data-active-view="agents"] .message-quote,
body[data-active-view="agents"] .quote-composer {
  border-left-color: rgba(214, 165, 78, 0.82);
  background: rgba(214, 165, 78, 0.12);
}

body[data-active-view="agents"] .message-quote span,
body[data-active-view="agents"] .quote-composer span {
  color: #e4c26f;
}

body[data-active-view="agents"] .quote-composer p {
  color: rgba(245, 241, 233, 0.62);
}

body[data-active-view="agents"] .quote-composer button {
  border-color: rgba(214, 165, 78, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #f1d49b;
}

#agentsView .message-content {
  color: inherit;
  font-size: 15px;
  font-weight: 750;
}

#agentsView .message-content h4 {
  margin: 22px 0 12px;
  color: #fffaf0;
  font-size: 18px;
  line-height: 1.45;
}

#agentsView .message-content h4:first-child {
  margin-top: 0;
}

#agentsView .message-content p {
  margin: 0 0 11px;
}

#agentsView .message-content hr {
  height: 1px;
  margin: 24px 0;
  background: rgba(255, 255, 255, 0.12);
}

#agentsView .message-list-line {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  margin: 7px 0;
}

#agentsView .message-list-line span {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  background: linear-gradient(180deg, #e1c071, #a5792e);
  color: #14110b;
  font-size: 12px;
}

#agentsView .message.user .message-list-line span {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

#agentsView .message-meta {
  border-top-color: rgba(255, 255, 255, 0.12);
  color: rgba(245, 241, 233, 0.58);
}

#agentsView .message-attachments article {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
}

#agentsView .message-attachments strong {
  color: #fffaf0;
}

#agentsView .message-attachments p {
  color: rgba(245, 241, 233, 0.68);
}

#agentsView .artifact-card {
  border-color: rgba(214, 165, 78, 0.26);
  background: rgba(255, 255, 255, 0.07);
}

#agentsView .artifact-card strong {
  color: #fffaf0;
}

#agentsView .artifact-card p {
  color: rgba(245, 241, 233, 0.68);
}

#agentsView .artifact-card a {
  color: #f1d49b;
}

#agentsView .message.pending .message-content {
  color: rgba(245, 241, 233, 0.78);
}

@media (max-width: 1060px) {
  .login-screen,
  .app-shell,
  .dashboard-grid,
  .context-layout,
  .usage-layout,
  .knowledge-layout,
  .settings-grid,
  .agents-layout,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .login-screen {
    justify-items: center;
    gap: 36px;
    text-align: center;
  }

  .brand-line {
    justify-content: center;
  }

  .login-copy {
    display: grid;
    justify-items: center;
  }

  .login-metrics {
    width: min(520px, 100%);
  }

  .command-center,
  .ops-strip,
  .module-grid,
  .dashboard-module-tabs,
  .dashboard-agent-board,
  .context-rule-grid,
  .agent-switcher {
    grid-template-columns: 1fr;
  }

  .chat-workspace {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .chat-workspace.conversation-collapsed {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .sidebar {
    min-height: auto;
    padding: 12px;
    gap: 10px;
  }

  .brand-block {
    justify-content: center;
  }

  #mainNav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-btn {
    min-height: 40px;
    text-align: center;
    padding: 8px;
    font-size: 14px;
  }

  .sidebar-card,
  .ghost-dark-btn {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    position: static;
  }

  .command-copy h3 {
    font-size: 32px;
  }

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

  .agent-grid {
    max-height: none;
  }

  .knowledge-list {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .login-screen,
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .login-copy h1 {
    font-size: clamp(30px, 9vw, 42px);
  }

  .login-title {
    white-space: normal;
  }

  .login-logo-image {
    width: 118px;
    height: 118px;
  }

  .login-logo-emblem {
    width: 92px;
    height: 92px;
    border-radius: 22px;
  }

  .login-logo-emblem::before {
    inset: 12px;
    border-radius: 16px;
  }

  .logo-corner {
    left: 24px;
    top: 23px;
    width: 30px;
    height: 36px;
    border-left-width: 8px;
    border-bottom-width: 8px;
  }

  .logo-dot {
    right: 24px;
    top: 24px;
    width: 11px;
    height: 11px;
  }

  .logo-ray {
    left: 20px;
    bottom: 20px;
    width: 50px;
  }

  .login-metrics {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .login-metrics article {
    min-height: 74px;
  }

  .dashboard-module-tabs {
    grid-template-columns: 1fr;
  }

  .dashboard-agent-section-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-module-arrows {
    grid-column: 1 / -1;
  }

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

  .topbar,
  .chat-header {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .chat-model-picker {
    justify-self: stretch;
    width: 100%;
  }

  .chat-agent-title {
    grid-template-columns: 1fr;
  }

  .header-agent-picker {
    grid-template-columns: 1fr;
  }

  .usage-pagination {
    justify-content: center;
  }

  #mainNav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-block {
    justify-content: flex-start;
  }

  .command-copy h3 {
    font-size: 28px;
  }

  .toolbar,
  .usage-toolbar,
  .form-grid,
  .conversation-toolbar,
  .knowledge-check-grid,
  .artifact-card.image-artifact,
  .agent-switcher,
  .chat-workspace,
  .chat-workspace.conversation-collapsed {
    grid-template-columns: 1fr;
  }

  .chat-workspace.conversation-collapsed .conversation-sidebar {
    min-height: 48px;
  }

  .conversation-sidebar {
    max-height: 230px;
    min-height: 190px;
  }

  .message {
    max-width: 100%;
  }

  #agentsView .message,
  #agentsView .message.user {
    max-width: 100%;
  }
}
