:root {
  color-scheme: dark;
  --bg: #03080c;
  --surface: #071015;
  --surface-2: #0a141b;
  --surface-3: #111e27;
  --line: #172832;
  --line-strong: #263944;
  --text: #e8edf2;
  --muted: #7c8791;
  --muted-2: #53616b;
  --accent: #ff8a00;
  --accent-2: #6a3900;
  --accent-soft: rgba(255, 138, 0, 0.12);
  --good: #3ddc97;
  --bad: #ff5d5d;
  --editor-bg: #f8fafc;
  --editor-gutter-bg: #e2e8f0;
  --editor-panel-bg: #edf2f7;
  --editor-caret: #0f172a;
  --editor-dialog-width: 755px;
  --agent-chat-gap: 10px;
  --agent-chat-padding: 14px;
  --agent-chat-radius: 14px;
  --agent-chat-mobile-padding-x: 8px;
  --agent-message-max-width: 88%;
  --agent-message-mobile-max-width: 96%;
  --agent-message-padding-y: 11px;
  --agent-message-padding-x: 13px;
  --agent-message-mobile-padding-x: 11px;
  --agent-composer-min-height: 152px;
  --agent-input-min-height: 92px;
  --agent-input-padding: 18px 20px 8px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  background: var(--bg);
}

html:has(.view.active #projectCreatePane:not(.hidden)),
body:has(.view.active #projectCreatePane:not(.hidden)) {
  overflow: hidden;
}

html:has(.view.active[data-view="files"]),
body:has(.view.active[data-view="files"]),
html:has(.view.active .card-list-pane:not(.hidden)),
body:has(.view.active .card-list-pane:not(.hidden)),
html:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="files"]),
body:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="files"]),
html:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]),
body:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]),
html[data-initial-view="files"],
html[data-initial-view="files"] body,
html[data-initial-view="templates"],
html[data-initial-view="templates"] body,
html[data-initial-view="scaffolds"],
html[data-initial-view="scaffolds"] body,
html[data-initial-view="projects"],
html[data-initial-view="projects"] body {
  overflow: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 82% 112%, rgba(255, 138, 0, 0.08), transparent 25rem),
    linear-gradient(135deg, #03080c 0%, #03070a 48%, #050b10 100%);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 138, 0, 0.1), transparent 34%),
    #02070b;
}

.auth-gate.hidden {
  display: none;
}

.auth-card {
  display: grid;
  gap: 30px;
  width: min(440px, 100%);
  padding: clamp(28px, 5vw, 44px);
  color: var(--text);
  background: rgba(8, 20, 27, 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}

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

.auth-brand img {
  width: 42px;
  height: 42px;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

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

.auth-brand span,
.auth-description {
  color: var(--muted);
}

.auth-brand span {
  margin-top: 2px;
  font-size: 12px;
}

.auth-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(26px, 6vw, 36px);
}

.auth-description {
  margin: 12px 0 0;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
}

.auth-form input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(255, 138, 0, 0.18);
}

.auth-error {
  margin: -4px 0 0;
  color: #ff8c8c;
  font-size: 13px;
}

.account-security-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 14px;
}

.account-security-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.account-security-form input {
  min-height: 42px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}

.account-security-form .settings-message {
  grid-column: 1 / -1;
  min-height: 0;
  margin: 0;
}

@media (max-width: 900px) {
  .account-security-form {
    grid-template-columns: 1fr;
  }
}

button, input, select, textarea, .button-link {
  font: inherit;
}

button, .button-link {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: grayscale(0.25);
}

.shell {
  --sidebar-width: 227px;
  --sidebar-toggle-top: 32px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.shell.sidebar-collapsed {
  --sidebar-width: 59px;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: visible;
  background: rgba(1, 6, 9, 0.92);
  border-right: 1px solid var(--line-strong);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line-strong);
}

.sidebar-toggle {
  position: absolute;
  top: var(--sidebar-toggle-top);
  right: -20px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: 0;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sidebar-toggle:hover {
  color: var(--accent);
  border-color: rgba(255, 138, 0, 0.38);
}

.sidebar-toggle span {
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

.brand-mark, .hero-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
  background: linear-gradient(145deg, rgba(255, 138, 0, 0.2), rgba(255, 138, 0, 0.06));
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.brand-mark svg, .hero-mark svg,
.brand-mark img, .hero-mark img {
  width: 26px;
  height: 26px;
}

.brand-mark img, .hero-mark img {
  display: block;
  object-fit: contain;
}

svg path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.brand-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
  overflow: visible;
  padding: 18px 10px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 52px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 650;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
}

.nav-item.active {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.1);
  border-color: rgba(255, 138, 0, 0.42);
}

.experimental-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 22px;
  padding: 2px 8px;
  color: #ffbd66;
  background: rgba(255, 138, 0, 0.1);
  border: 1px solid rgba(255, 138, 0, 0.42);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-item-label {
  min-width: 0;
}

.nav-experimental-badge {
  min-height: 18px;
  margin-left: auto;
  padding: 2px 5px;
  font-size: 8px;
  letter-spacing: 0.02em;
}

html[data-initial-view]:not([data-initial-view="dashboard"]) .nav-item.active {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

html[data-initial-view="templates"] .nav-item[data-view-target="templates"],
html[data-initial-view="scaffolds"] .nav-item[data-view-target="scaffolds"],
html[data-initial-view="projects"] .nav-item[data-view-target="projects"],
html[data-initial-view="emulator"] .nav-item[data-view-target="emulator"],
html[data-initial-view="files"] .nav-item[data-view-target="files"],
html[data-initial-view="settings"] .nav-item[data-view-target="settings"] {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.1);
  border-color: rgba(255, 138, 0, 0.42);
}

.shell.sidebar-collapsed .nav-item::before,
.shell.sidebar-collapsed .nav-item::after {
  position: absolute;
  left: calc(100% + 10px);
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.shell.sidebar-collapsed .nav-item::before {
  content: "";
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--surface-3);
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  transform: translateY(-50%) translateX(-4px) rotate(45deg);
}

.shell.sidebar-collapsed .nav-item::after {
  content: attr(aria-label);
  top: 50%;
  width: max-content;
  max-width: 180px;
  padding: 7px 10px;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.shell.sidebar-collapsed .nav-item:hover::before,
.shell.sidebar-collapsed .nav-item:hover::after,
.shell.sidebar-collapsed .nav-item:focus-visible::before,
.shell.sidebar-collapsed .nav-item:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.shell.sidebar-collapsed .nav-item:hover::before,
.shell.sidebar-collapsed .nav-item:focus-visible::before {
  transform: translateY(-50%) translateX(0) rotate(45deg);
}

.nav-icon,
.small-accent,
.grid-icon, .folder-icon, .layers-icon, .file-icon,
.branch-icon, .download-icon, .bot-icon, .shield-icon, .gear-icon,
.tag-icon, .calendar-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: currentColor;
}

svg.nav-icon {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.grid-icon::before {
  content: "";
  position: absolute;
  inset: 3px;
  background:
    linear-gradient(currentColor 0 0) 0 0 / 8px 8px no-repeat,
    linear-gradient(currentColor 0 0) 13px 0 / 8px 8px no-repeat,
    linear-gradient(currentColor 0 0) 0 13px / 8px 8px no-repeat,
    linear-gradient(currentColor 0 0) 13px 13px / 8px 8px no-repeat;
  border-radius: 3px;
  opacity: 0.95;
}

.folder-icon::before,
.folder-icon::after {
  content: "";
  position: absolute;
  border: 2px solid currentColor;
}

.folder-icon::before {
  left: 2px;
  top: 6px;
  width: 8px;
  height: 5px;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.folder-icon::after {
  left: 2px;
  top: 9px;
  width: 20px;
  height: 12px;
  border-radius: 4px;
}

.layers-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 18px;
  height: 18px;
  background:
    linear-gradient(30deg, transparent 36%, currentColor 37% 43%, transparent 44%) 0 0 / 100% 8px no-repeat,
    linear-gradient(150deg, transparent 36%, currentColor 37% 43%, transparent 44%) 0 0 / 100% 8px no-repeat,
    linear-gradient(30deg, transparent 36%, currentColor 37% 43%, transparent 44%) 0 7px / 100% 8px no-repeat,
    linear-gradient(150deg, transparent 36%, currentColor 37% 43%, transparent 44%) 0 7px / 100% 8px no-repeat,
    linear-gradient(30deg, transparent 36%, currentColor 37% 43%, transparent 44%) 0 14px / 100% 8px no-repeat,
    linear-gradient(150deg, transparent 36%, currentColor 37% 43%, transparent 44%) 0 14px / 100% 8px no-repeat;
}

.file-icon::before {
  content: "";
  position: absolute;
  inset: 3px 5px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.file-icon::after {
  content: "<>";
  position: absolute;
  left: 4px;
  top: 7px;
  font: 700 10px/1 ui-monospace, monospace;
}

.branch-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  width: 11px;
  height: 15px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 0 8px;
}

.branch-icon::after {
  content: "";
  position: absolute;
  inset: 3px;
  background:
    radial-gradient(circle, currentColor 0 3px, transparent 3.5px) 1px 0 / 8px 8px no-repeat,
    radial-gradient(circle, currentColor 0 3px, transparent 3.5px) 1px 15px / 8px 8px no-repeat,
    radial-gradient(circle, currentColor 0 3px, transparent 3.5px) 15px 8px / 8px 8px no-repeat;
}

.download-icon::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 3px;
  width: 2px;
  height: 12px;
  background: currentColor;
}

.download-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 12px;
  width: 14px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.bot-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 7px;
  width: 16px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.bot-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 8px;
  height: 4px;
  border-top: 2px solid currentColor;
  border-radius: 6px;
  box-shadow: 2px 10px 0 -1px currentColor, 8px 10px 0 -1px currentColor;
}

.shield-icon::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 14px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 9px 9px 10px 10px;
}

.gear-icon::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 -6px 0 -4px currentColor, 0 6px 0 -4px currentColor, 6px 0 0 -4px currentColor, -6px 0 0 -4px currentColor;
}

.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding: 22px 24px;
  border-top: 1px solid var(--line-strong);
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--accent);
  background: var(--accent-2);
  border-radius: 50%;
  font-weight: 800;
}

.profile-name {
  font-weight: 800;
  font-size: 14px;
}

.profile-role {
  color: var(--muted);
  font-size: 13px;
}

.profile-copy {
  min-width: 0;
}

.profile-logout {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 17px;
}

.profile-logout:hover,
.profile-logout:focus-visible {
  color: var(--accent);
  border-color: rgba(255, 138, 0, 0.42);
}

.shell.sidebar-collapsed .brand {
  justify-content: center;
  padding: 18px 5px;
}

.shell.sidebar-collapsed .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.shell.sidebar-collapsed .brand-mark img,
.shell.sidebar-collapsed .brand-mark svg {
  width: 23px;
  height: 23px;
}

.shell.sidebar-collapsed .brand > div:nth-child(2),
.shell.sidebar-collapsed .nav-item span:last-child,
.shell.sidebar-collapsed .nav-item-label,
.shell.sidebar-collapsed .nav-experimental-badge,
.shell.sidebar-collapsed .profile-copy,
.shell.sidebar-collapsed .profile-logout,
.shell.sidebar-collapsed .profile > div:last-child {
  display: none;
}

.shell.sidebar-collapsed .sidebar-toggle span {
  transform: rotate(225deg);
}
.shell.sidebar-collapsed .nav {
  padding: 18px 5px;
}

.shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.shell.sidebar-collapsed .profile {
  justify-content: center;
  padding: 22px 5px;
}

.main {
  min-width: 0;
}

.title-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

.breadcrumb-nav {
  display: none !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  padding: 7px 34px;
  color: var(--muted-2);
  background: rgba(3, 8, 12, 0.62);
  border-bottom: 1px solid rgba(23, 40, 50, 0.72);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

html[data-initial-view="dashboard"] .breadcrumb-nav {
  display: none;
}

.breadcrumb-nav.single {
  opacity: 0.76;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: inherit;
  font-weight: inherit;
}

button.breadcrumb-item:hover {
  color: var(--accent);
}

.breadcrumb-item.current {
  color: var(--text);
}

.breadcrumb-separator {
  color: var(--muted-2);
}

.primary-action, .button-link, button[type="submit"], #saveProjectRule, #saveScaffoldRule {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 18px;
  color: #090a0c;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 11px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: filter 160ms ease, transform 160ms ease;
}

.primary-action:hover, .button-link:hover, button[type="submit"]:hover, #saveProjectRule:hover, #saveScaffoldRule:hover {
  filter: brightness(1.08);
}

.primary-action.compact {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

.view {
  display: none;
  padding: 14px 28px;
}

.view.active {
  display: block;
}

html[data-initial-view]:not([data-initial-view="dashboard"]) .breadcrumb-nav {
  visibility: hidden;
}

html[data-initial-view]:not([data-initial-view="dashboard"]) .view.active {
  display: none;
}

html[data-initial-view="templates"] .view[data-view="templates"],
html[data-initial-view="scaffolds"] .view[data-view="scaffolds"],
html[data-initial-view="projects"] .view[data-view="projects"],
html[data-initial-view="emulator"] .view[data-view="emulator"],
html[data-initial-view="files"] .view[data-view="files"],
html[data-initial-view="settings"] .view[data-view="settings"] {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.stat-card, .card, .hero-card {
  background: linear-gradient(180deg, rgba(8, 17, 23, 0.98), rgba(6, 13, 18, 0.98));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.stat-card {
  display: flex;
  justify-content: space-between;
  min-height: 150px;
  padding: 24px;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.stat-card strong {
  display: block;
  margin: 6px 0 10px;
  font-size: 38px;
  line-height: 1;
}

.stat-icon {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: 16px;
}

.stat-icon > span {
  color: inherit;
}

.dashboard-grid, .workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  margin-top: 28px;
}

.card {
  min-width: 0;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}

.card-header h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 18px;
}

.small-accent {
  color: var(--accent);
}

.list-empty {
  display: grid;
  place-items: center;
  min-height: 126px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.recent-list {
  min-height: 126px;
}

.recent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.recent-row:last-child {
  border-bottom: 0;
}

.row-title {
  font-size: 15px;
  font-weight: 800;
}

.row-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  padding: 5px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.status.succeeded {
  color: var(--good);
  border-color: rgba(61, 220, 151, 0.35);
}

.status.failed {
  color: var(--bad);
  border-color: rgba(255, 93, 93, 0.35);
}

.status.running, .status.queued {
  color: var(--accent);
  border-color: rgba(255, 138, 0, 0.35);
}

.hero-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  margin-top: 28px;
  padding: 30px;
}

.hero-mark {
  width: 66px;
  height: 66px;
  border-radius: 18px;
}

.hero-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.hero-card p {
  max-width: 960px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.ghost-action, .link-button {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 11px;
  text-decoration: none;
}

.ghost-action {
  min-height: 42px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
}

.ghost-action.compact {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

.link-button {
  width: auto;
  padding: 0;
  color: var(--muted);
  border: 0;
  font-size: 14px;
}

.link-button:hover, .ghost-action:hover {
  color: var(--accent);
  border-color: rgba(255, 138, 0, 0.38);
}

.stack {
  display: grid;
  gap: 12px;
  padding: 22px 24px;
}

.toolbar, .form-row, .button-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar {
  padding: 18px 24px;
}

.form-row {
  padding: 22px 24px 12px;
}

.form-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.form-row button {
  flex: 0 0 180px;
  white-space: nowrap;
}

.button-group.end {
  justify-content: flex-end;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 8px;
  padding: 14px 24px 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  color: var(--text);
  background: #040b10;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

input, select {
  min-height: 40px;
  padding: 0 13px;
}

input[type="file"] {
  padding: 10px 13px;
}

.template-upload-dropzone {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  min-height: 72px;
  padding: 12px 20px;
  color: var(--text);
  background: #040b10;
  border: 1px dashed rgba(132, 151, 164, 0.45);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.template-upload-dropzone:focus-within,
.template-upload-dropzone:hover,
.template-upload-dropzone.is-dragover {
  border-color: rgba(255, 138, 0, 0.72);
  background: rgba(255, 138, 0, 0.06);
  box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.08);
}

.template-upload-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.template-upload-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  color: #f4f8fb;
  background: rgba(132, 151, 164, 0.7);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.template-upload-file-name {
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-upload-hint {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

textarea {
  min-height: 220px;
  padding: 13px;
  resize: vertical;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(255, 138, 0, 0.62);
  box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.08);
}

.grid-2, .grid-3 {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 24px 14px;
}

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

.meta-line {
  padding: 0 24px 24px;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.file-list, .artifact-list {
  max-height: 520px;
  overflow: auto;
}

.file-row, .artifact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.file-row:last-child, .artifact-row:last-child {
  border-bottom: 0;
}

.path {
  overflow: hidden;
  color: #cdd5dc;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
  padding: 8px 24px 24px;
}

h3 {
  margin: 18px 0 10px;
  color: #cdd5dc;
  font-size: 13px;
}

.dynamic-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 14px;
}

pre {
  min-height: 100px;
  max-height: 260px;
  margin: 0 24px 24px;
  overflow: auto;
  padding: 16px;
  color: #cfe4ff;
  background: #02070b;
  border: 1px solid var(--line);
  border-radius: 14px;
  white-space: pre-wrap;
}

#projectConfig {
  min-height: 480px;
  margin: 0 24px 24px;
  width: calc(100% - 48px);
}

#ruleScript {
  min-height: 440px;
}

#ruleSchema {
  min-height: 260px;
}

.code-card {
  min-height: calc(100vh - 196px);
}

.code-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 0;
}

.artifact-list {
  border-right: 1px solid var(--line);
}

.artifact-row {
  grid-template-columns: minmax(0, 1fr);
  cursor: pointer;
}

.artifact-row:hover {
  background: rgba(255, 138, 0, 0.07);
}

#codeViewer {
  min-height: 620px;
  border: 0;
  border-radius: 0;
  background: #02070b;
}

.placeholder-card {
  padding: 38px;
}

.repository-note {
  margin-top: 24px;
}

.placeholder-card h2 {
  margin: 0 0 10px;
}

.placeholder-card p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.card-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.settings-card {
  padding-bottom: 24px;
}

.metadata-settings-editor,
.code-editor-settings-editor {
  padding: 20px 24px 10px;
}

.metadata-settings-editor textarea,
.code-editor-settings-editor textarea {
  min-height: 520px;
  resize: vertical;
  color: #dce4ea;
  background: #02070b;
  border-color: rgba(130, 146, 158, 0.22);
  font: 13px/1.55 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.settings-panel {
  display: none;
}

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

.settings-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 18px 24px 0;
}

.settings-status span {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 11px 13px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.settings-status small {
  color: #84919b;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.settings-status strong {
  min-width: 0;
  overflow: hidden;
  color: #edf4f8;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-status .ok strong {
  color: #8ad7a5;
}

.settings-status .warn strong {
  color: #ffbf70;
}

.settings-form {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
  padding: 20px 24px 10px;
}

.settings-form label {
  color: #9eabb5;
}

.provider-first-settings {
  grid-template-columns: 1fr;
  align-items: start;
}

.settings-provider-models-panel,
.settings-provider-access-panel,
.settings-active-models-panel,
.settings-route-panel,
.settings-provider-panel,
.settings-profiles-panel,
.settings-interaction-panel {
  min-width: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-route-panel {
  align-self: start;
}

.settings-provider-panel {
  align-self: start;
}

.settings-profiles-panel {
  grid-column: 1 / -1;
}

.settings-interaction-panel {
  display: grid;
  gap: 14px;
}

.agent-interaction-settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.provider-models-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(420px, 1.12fr);
  gap: 16px;
  align-items: start;
}

.provider-access-column,
.active-models-column {
  min-width: 0;
}

.settings-provider-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 180px);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.provider-access-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 8px;
}

.provider-access-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.provider-access-card-head strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.provider-access-card-head small {
  display: block;
  margin-top: 4px;
  color: #84919b;
  font-size: 12px;
}

.provider-access-status {
  flex: 0 0 auto;
  max-width: 170px;
  overflow: hidden;
  padding: 5px 9px;
  color: #84919b;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-access-status.ok {
  color: #8ad7a5;
  background: rgba(138, 215, 165, 0.08);
  border-color: rgba(138, 215, 165, 0.26);
}

.provider-access-status.warn {
  color: #ffbf70;
  background: rgba(255, 138, 0, 0.08);
  border-color: rgba(255, 138, 0, 0.25);
}

.provider-access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.provider-access-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
}

.settings-field-label.visible {
  display: block;
}

.active-model-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 12px;
}

.active-model-summary span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 9px;
  color: #b8c5cd;
  background: rgba(88, 166, 255, 0.055);
  border: 1px solid rgba(88, 166, 255, 0.16);
  border-radius: 999px;
  font-size: 12px;
}

.active-model-summary strong {
  color: #edf4f8;
}

.settings-model-list {
  display: grid;
  gap: 8px;
  overflow: visible;
}

.settings-model-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 11px;
  color: #d8e2e8;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 8px;
}

.settings-model-row:hover {
  border-color: rgba(255, 138, 0, 0.22);
}

.settings-model-row.active {
  background: rgba(138, 215, 165, 0.055);
  border-color: rgba(138, 215, 165, 0.22);
}

.settings-model-row.default {
  border-color: rgba(255, 184, 77, 0.34);
}

.settings-model-row.needs-key:not(.active) {
  opacity: 0.78;
}

.settings-model-toggle {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.settings-model-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #8ad7a5;
}

.settings-model-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.settings-model-main strong,
.settings-model-main small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-model-main strong {
  color: var(--text);
  font-size: 13px;
}

.settings-model-main small {
  color: #84919b;
  font-size: 12px;
}

.settings-model-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.settings-model-meta span {
  padding: 4px 7px;
  color: #91a1ac;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.settings-default-model-button {
  min-width: 86px;
  padding: 6px 9px;
  color: #9aa8b3;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.settings-default-model-button:hover {
  color: #f1f5f9;
  border-color: rgba(255, 138, 0, 0.32);
}

.settings-default-model-button.active {
  color: #ffe5b8;
  background: rgba(255, 184, 77, 0.1);
  border-color: rgba(255, 184, 77, 0.34);
}

.settings-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.settings-section-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.settings-section-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.settings-section-head p {
  margin: 4px 0 0;
  color: #7f8b94;
  font-size: 12px;
  line-height: 1.45;
}

.settings-mini-badge {
  flex: 0 0 auto;
  max-width: 180px;
  overflow: hidden;
  padding: 5px 9px;
  color: #dbe5eb;
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 999px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.provider-preset-grid {
  align-items: end;
}

.provider-preset-hint {
  margin-top: 14px;
  padding: 11px 12px;
  color: #91a1ac;
  background: rgba(88, 166, 255, 0.055);
  border: 1px solid rgba(88, 166, 255, 0.16);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.settings-switch-field {
  display: grid;
  gap: 7px;
}

.settings-profile-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: 0 0 14px;
}

.settings-thinking-field {
  flex: 0 0 180px;
  width: 180px;
}

.settings-switch {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-switch input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.settings-switch span {
  position: relative;
  width: 38px;
  height: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.settings-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #8b98a3;
  border-radius: 50%;
  transition: transform 140ms ease, background 140ms ease;
}

.settings-switch input:checked + span {
  background: rgba(138, 215, 165, 0.1);
  border-color: rgba(138, 215, 165, 0.32);
}

.settings-switch input:checked + span::after {
  background: #8ad7a5;
  transform: translateX(16px);
}

.settings-switch strong {
  min-width: 0;
  overflow: hidden;
  color: #dce6ec;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-code-field {
  display: grid;
  gap: 7px;
}

.settings-form .settings-code-field textarea {
  min-height: 126px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
}

.settings-form textarea[name="pi_model_profiles"],
.settings-form textarea[name="pi_provider_api_keys"] {
  min-height: 126px;
}

.settings-editor-head,
.settings-edit-row {
  display: grid;
  gap: 10px;
  align-items: end;
}

.settings-editor-head {
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1fr) 36px;
  margin-bottom: 8px;
  color: #84919b;
  font-size: 11px;
  text-transform: uppercase;
}

.settings-profile-editor-head,
.model-profile-row {
  grid-template-columns: minmax(120px, 0.8fr) minmax(140px, 0.85fr) minmax(190px, 1.2fr) minmax(170px, 1fr) 74px 74px;
}

.settings-row-editor {
  display: grid;
  gap: 10px;
}

.settings-edit-row {
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1fr) 36px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 8px;
}

.settings-edit-row.model-profile-row {
  grid-template-columns: minmax(120px, 0.8fr) minmax(140px, 0.85fr) minmax(190px, 1.2fr) minmax(170px, 1fr) 74px 74px;
}

.settings-edit-row label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
}

.settings-field-label {
  display: none;
}

.settings-delete-row {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #ffbf70;
  background: rgba(255, 138, 0, 0.07);
  border: 1px solid rgba(255, 138, 0, 0.22);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
}

.settings-delete-row:hover,
.settings-delete-row:focus {
  color: #ffd4a0;
  border-color: rgba(255, 138, 0, 0.42);
}

.settings-test-row {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
}

.settings-default-profile-badge {
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  padding: 0 10px;
  color: #8ad7a5;
  background: rgba(138, 215, 165, 0.08);
  border: 1px solid rgba(138, 215, 165, 0.24);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.settings-profile-toolbar .settings-add-row {
  flex: 0 0 auto;
  width: auto;
  min-width: 148px;
  margin-top: 0;
}

.settings-add-row {
  width: 100%;
  margin-top: 12px;
}

.settings-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  margin-top: 12px;
}

.settings-token-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 6px 9px;
  color: #dce6ec;
  background: rgba(138, 215, 165, 0.07);
  border: 1px solid rgba(138, 215, 165, 0.22);
  border-radius: 999px;
  font-size: 12px;
}

.settings-token-list span.warn {
  color: #ffbf70;
  background: rgba(255, 138, 0, 0.07);
  border-color: rgba(255, 138, 0, 0.22);
}

.settings-token-list span small {
  color: #84919b;
  font-size: 11px;
}

.settings-token-list .empty,
.settings-profile-preview .empty {
  color: #7f8b94;
  background: transparent;
  border-color: var(--line);
}

.settings-profile-preview {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.settings-profile-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.1fr) minmax(90px, 0.7fr) minmax(150px, 1.2fr) minmax(120px, 0.8fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 9px 11px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 8px;
}

.settings-profile-row.header {
  min-height: 34px;
  color: #84919b;
  background: transparent;
  border-color: transparent;
  font-size: 11px;
  text-transform: uppercase;
}

.settings-profile-row span {
  min-width: 0;
  overflow: hidden;
  color: #d8e2e8;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-profile-row .profile-label {
  color: var(--text);
  font-weight: 700;
}

.settings-profile-row .profile-credential {
  color: #8ad7a5;
}

.settings-advanced {
  margin: 12px 24px 0;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.settings-advanced summary {
  cursor: pointer;
  padding: 16px 18px;
  color: var(--text);
  font-weight: 700;
}

.compact-settings {
  padding-top: 0;
}

.settings-message {
  min-height: 56px;
  margin-top: 16px;
}

.skill-settings-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  padding: 20px 24px 10px;
}

.skill-startup-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.5fr) auto;
  gap: 14px;
  align-items: center;
  margin: 18px 24px 0;
  padding: 14px 16px;
  background: rgba(88, 166, 255, 0.035);
  border: 1px solid rgba(88, 166, 255, 0.18);
  border-radius: 8px;
}

.skill-startup-bar strong {
  display: block;
  color: var(--text);
}

.skill-startup-bar small {
  display: block;
  margin-top: 4px;
  color: #8f9da7;
}

.skill-install-panel,
.skill-list-panel {
  min-width: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.skill-content-field textarea {
  min-height: 170px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
}

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

.skill-settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 8px;
}

.skill-settings-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.skill-settings-title strong {
  color: var(--text);
}

.skill-settings-title span {
  padding: 4px 8px;
  color: #dbe5eb;
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 999px;
  font-size: 12px;
}

.skill-settings-title .enabled {
  color: #8ad7a5;
  background: rgba(138, 215, 165, 0.07);
  border-color: rgba(138, 215, 165, 0.22);
}

.skill-settings-title .disabled {
  color: #ffbf70;
  background: rgba(255, 138, 0, 0.07);
  border-color: rgba(255, 138, 0, 0.22);
}

.skill-settings-row p {
  margin: 8px 0 7px;
  color: #a7b4bd;
  font-size: 13px;
  line-height: 1.45;
}

.skill-settings-row code {
  color: #84919b;
  font-size: 12px;
}

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

.danger-action {
  color: #ffbf70;
}

.prompt-template-grid {
  display: grid;
  gap: 14px;
  padding: 20px 24px 10px;
}

.pi-base-prompt-card {
  display: grid;
  gap: 12px;
  margin: 20px 24px 0;
  padding: 16px;
  background: rgba(88, 166, 255, 0.035);
  border: 1px solid rgba(88, 166, 255, 0.18);
  border-radius: 14px;
}

.pi-base-prompt-card strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.pi-base-prompt-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

#piBasePromptViewer {
  min-height: 220px;
  resize: vertical;
  color: #b9c5ce;
  background: rgba(2, 7, 11, 0.72);
  border-color: rgba(88, 166, 255, 0.16);
  font: 12px/1.55 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.prompt-template-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.prompt-template-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.prompt-template-card-head > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.prompt-template-card strong {
  color: var(--text);
  font-size: 15px;
}

.prompt-template-card small {
  color: var(--muted);
  font-size: 13px;
}

.prompt-template-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted-2);
  font-size: 12px;
}

.prompt-template-vars code {
  padding: 2px 7px;
  color: #ffd9ad;
  background: rgba(255, 138, 0, 0.08);
  border: 1px solid rgba(255, 138, 0, 0.2);
  border-radius: 999px;
}

.prompt-template-card textarea {
  min-height: 156px;
  resize: vertical;
  color: #dce4ea;
  background: #02070b;
  border-color: rgba(130, 146, 158, 0.22);
  font: 13px/1.55 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.prompt-template-card:first-child textarea,
.prompt-template-card:last-child textarea {
  min-height: 82px;
}

.hidden,
.visually-hidden {
  display: none !important;
}

.resource-list-pane,
.scaffold-list-pane,
.project-list-pane {
  display: grid;
  gap: 24px;
}

.project-create-pane {
  display: grid;
  gap: 18px;
}

.template-detail-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  height: 100%;
}

.template-detail-header {
  min-height: 70px;
}

.template-file-workbench {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.template-agent-workbench {
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.template-agent-workbench.hidden,
.template-file-workbench.hidden {
  display: none;
}

.template-agent-session-chat {
  grid-row: 1;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.template-agent-session-preview {
  grid-row: 1;
}

.template-agent-composer {
  position: relative;
  bottom: auto;
  z-index: 12;
  padding-top: 12px;
  background:
    linear-gradient(180deg, rgba(3, 8, 12, 0), var(--bg) 34%),
    var(--bg);
}

.template-agent-composer-shell {
  min-height: var(--agent-composer-min-height);
  overflow: visible;
  position: relative;
  z-index: 12;
}

.template-agent-output-browser {
  min-height: 0;
  height: 100%;
  grid-template-columns: 1fr;
}

.template-agent-output-browser .generated-file-list {
  border-right: 0;
}

.template-robot-open-button {
  flex: 0 0 auto;
}

.template-robot-open-button img {
  width: 21px;
  height: 21px;
  object-fit: contain;
}

.template-robot-dialog {
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, 100%);
  height: auto;
  max-height: min(780px, calc(100vh - 48px));
}

.template-robot-properties-panel {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.template-robot-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 14px;
}

.template-robot-panel-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.template-robot-panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.template-robot-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.template-robot-metadata-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.template-robot-name-field {
  grid-column: 1 / -1;
}

.template-robot-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.template-robot-form label span {
  color: var(--muted);
  font-size: 12px;
}

.template-robot-form input,
.template-robot-form select,
.template-robot-form textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.template-robot-form select {
  color-scheme: dark;
}

.template-robot-form select option {
  color: #f4f7fa;
  background-color: #071017;
}

.template-robot-form select option:checked,
.template-robot-form select option:hover {
  color: #ffffff;
  background-color: #244d72;
}

.template-robot-form textarea {
  resize: vertical;
}

.template-robot-wide {
  grid-column: span 2;
}

.template-robot-form-actions {
  grid-column: 1 / -1;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  margin: 8px -18px -18px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
}

.template-robot-form-actions .ghost-action,
.template-robot-form-actions .primary-action {
  min-width: 120px;
}

.template-file-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  background: rgba(7, 14, 19, 0.76);
  border: 0;
  border-radius: 8px;
}

.template-file-pathbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.template-path-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.template-current-path,
#templateCurrentPath {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  white-space: nowrap;
}

.template-path-crumb {
  min-width: 0;
  max-width: min(380px, 52vw);
  padding: 5px 4px;
  overflow: hidden;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  font: inherit;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-path-crumb:first-child {
  flex: 0 0 auto;
  width: 18px;
  padding-inline: 0;
  text-align: center;
}

.template-path-crumb:hover,
.template-path-crumb:focus-visible {
  color: #ffffff;
  background: rgba(130, 146, 158, 0.14);
  border-color: var(--line-strong);
  outline: none;
}

.template-path-crumb.current {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.035);
}

.template-path-separator {
  flex: 0 0 auto;
  color: var(--muted-2);
}

.template-file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  background: rgba(7, 14, 19, 0.78);
  border-bottom: 1px solid var(--line);
}

.template-file-actions .library-icon-button {
  width: 30px;
  height: 30px;
  color: rgba(159, 173, 186, 0.72);
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 9px;
}

.template-file-actions .library-icon-button:hover,
.template-file-actions .library-icon-button:focus-visible {
  color: rgba(226, 232, 240, 0.88);
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.22);
  outline: none;
}

.template-file-actions .library-icon-button.active {
  color: rgba(226, 232, 240, 0.92);
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.18);
}

.template-file-actions .library-list-icon,
.template-file-actions .library-grid-icon {
  width: 13px;
  height: 13px;
}

.template-file-actions .library-list-icon::before,
.template-file-actions .library-list-icon::after {
  top: 2px;
  opacity: 0.78;
}

.template-file-actions .library-list-icon::before {
  width: 2px;
  height: 2px;
  box-shadow: 0 4.5px 0 currentColor, 0 9px 0 currentColor;
}

.template-file-actions .library-list-icon::after {
  left: 5px;
  height: 1.5px;
  box-shadow: 0 4.5px 0 currentColor, 0 9px 0 currentColor;
}

.template-file-actions .library-grid-icon::before {
  inset: 2px;
  border: 1.5px solid currentColor;
  border-radius: 1.5px;
  opacity: 0.72;
  box-shadow: 7px 0 0 -1.5px currentColor, 0 7px 0 -1.5px currentColor, 7px 7px 0 -1.5px currentColor;
}

.template-file-actions #templateFileUp,
.template-file-actions #newTemplateDirectory,
.template-file-actions #uploadTemplateFiles {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  color: rgba(159, 173, 186, 0.72);
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 9px;
  font-size: 0;
}

.template-file-actions #templateFileUp:hover,
.template-file-actions #templateFileUp:focus-visible,
.template-file-actions #newTemplateDirectory:hover,
.template-file-actions #newTemplateDirectory:focus-visible,
.template-file-actions #uploadTemplateFiles:hover,
.template-file-actions #uploadTemplateFiles:focus-visible {
  color: rgba(226, 232, 240, 0.88);
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.22);
  outline: none;
}

.template-file-actions #uploadTemplateFiles {
  color: rgba(255, 176, 72, 0.82);
  background: rgba(255, 138, 0, 0.055);
  border-color: rgba(255, 138, 0, 0.14);
}

.template-file-actions #uploadTemplateFiles:hover,
.template-file-actions #uploadTemplateFiles:focus-visible {
  color: rgba(255, 196, 116, 0.94);
  background: rgba(255, 138, 0, 0.11);
  border-color: rgba(255, 138, 0, 0.24);
}

.template-file-actions #templateFileUp.ghost-action.compact,
.template-file-actions #newTemplateDirectory.ghost-action.compact,
.template-file-actions #uploadTemplateFiles.primary-action.compact {
  min-height: 30px;
}

.template-action-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.template-action-icon::before,
.template-action-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}

.template-up-icon::before {
  left: 6px;
  top: 3px;
  width: 2px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
}

.template-up-icon::after {
  left: 4px;
  top: 2px;
  width: 6px;
  height: 6px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-radius: 1px;
  transform: rotate(45deg);
}

.template-new-folder-icon::before {
  left: 1px;
  top: 4px;
  width: 12px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  opacity: 0.78;
}

.template-new-folder-icon::after {
  left: 3px;
  top: 2px;
  width: 5px;
  height: 4px;
  border-top: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  border-radius: 2px 0 0 0;
  opacity: 0.78;
}

.template-upload-icon::before {
  left: 6px;
  top: 2px;
  width: 2px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
}

.template-upload-icon::after {
  left: 4px;
  top: 2px;
  width: 6px;
  height: 6px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-radius: 1px;
  transform: rotate(45deg);
}

.template-upload-icon {
  border-bottom: 1.5px solid currentColor;
  border-radius: 0 0 2px 2px;
  opacity: 0.86;
}

.template-file-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.46fr) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.template-file-browser-panel,
.template-file-editor-panel {
  min-height: 0;
  background: linear-gradient(180deg, rgba(7, 14, 19, 0.96), rgba(4, 9, 13, 0.98));
  border: 1px solid var(--line);
  border-radius: 8px;
}

.template-file-browser-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.template-file-browser {
  display: grid;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  scrollbar-gutter: stable;
}

.template-file-browser.list-view {
  gap: 0;
}

.template-file-browser.grid-view {
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 10px;
}

.template-file-browser.is-drop-target {
  border-color: rgba(255, 138, 0, 0.62);
  box-shadow: inset 0 0 0 1px rgba(255, 138, 0, 0.28);
}

.template-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: 54px;
  padding: 2px 4px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.template-file-row.active {
  background: rgba(255, 138, 0, 0.1);
}

.template-file-main {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  padding: 7px 8px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
}

.template-file-main:hover,
.template-file-main:focus-visible,
.template-file-main.is-drop-target {
  background: rgba(130, 146, 158, 0.12);
  outline: none;
}

.template-file-main.is-drop-target {
  box-shadow: inset 0 0 0 1px rgba(255, 138, 0, 0.42);
}

.template-file-icon {
  display: grid;
  place-items: center;
  justify-self: center;
}

.template-file-icon.folder-icon {
  position: relative;
  width: 30px;
  height: 24px;
  color: var(--accent);
}

.template-file-icon.folder-icon::before {
  left: 2px;
  top: 8px;
  width: 24px;
  height: 13px;
  background: rgba(255, 138, 0, 0.16);
  border: 2px solid currentColor;
  border-radius: 5px 5px 4px 4px;
  box-shadow: inset 0 1px 0 rgba(255, 209, 150, 0.18);
}

.template-file-icon.folder-icon::after {
  left: 5px;
  top: 4px;
  width: 11px;
  height: 7px;
  background: rgba(255, 138, 0, 0.16);
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.template-file-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.template-file-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-file-copy strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.template-file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.2;
}

.template-file-meta em {
  flex: 0 0 auto;
  color: #aebbc5;
  font-style: normal;
}

.template-file-browser.grid-view .template-file-row {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 8px;
  min-height: 130px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.template-file-browser.grid-view .template-file-main {
  grid-template-columns: 1fr;
  justify-items: start;
  align-content: start;
  gap: 10px;
  padding: 0;
}

.template-file-browser.grid-view .template-file-icon {
  justify-self: start;
  margin-left: 2px;
}

.template-file-browser.grid-view .template-file-meta {
  display: grid;
  gap: 4px;
}

.template-file-editor-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.template-editor-host,
.template-asset-preview {
  min-height: 0;
  overflow: hidden;
}

.template-editor-host .code-editor-shell {
  height: 100%;
  border: 0;
  border-radius: 0;
}

.template-asset-preview {
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
  background: #02070b;
}

.template-asset-preview img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.template-editor-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 100%;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

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

.main:has(.view.active #projectCreatePane:not(.hidden)) {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.main:has(.view.active #templateDetailPane:not(.hidden)) {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.main:has(.view.active .card-list-pane:not(.hidden)),
html[data-initial-view="templates"] .main,
html[data-initial-view="scaffolds"] .main,
html[data-initial-view="projects"] .main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

html[data-initial-view="templates"] .main:has(#templateDetailPane:not(.hidden)) {
  grid-template-rows: minmax(0, 1fr);
}

html[data-initial-view="projects"] .main:has(.view[data-view="projects"] #projectCreatePane:not(.hidden)) {
  grid-template-rows: minmax(0, 1fr);
}

.main:has(.view.active[data-view="files"]),
html[data-initial-view="files"] .main {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.main:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="files"]),
.main:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]) {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

html[data-initial-view="dashboard"] .main,
.main.dashboard-home {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.main:has(.view.active #projectCreatePane:not(.hidden)) .view.active,
.view.active:has(#projectCreatePane:not(.hidden)) {
  min-height: 0;
  padding: 12px 28px 16px;
  overflow: hidden;
}

.main:has(.view.active #templateDetailPane:not(.hidden)) .view.active,
.view.active:has(#templateDetailPane:not(.hidden)) {
  min-height: 0;
  padding: 12px 28px 16px;
  overflow: hidden;
}

.main:has(.view.active .card-list-pane:not(.hidden)) .view.active,
.view.active:has(.card-list-pane:not(.hidden)),
html[data-initial-view="templates"] .view[data-view="templates"],
html[data-initial-view="scaffolds"] .view[data-view="scaffolds"],
html[data-initial-view="projects"] .view[data-view="projects"] {
  min-height: 0;
  overflow: hidden;
}

.view.active[data-view="dashboard"] {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: clamp(10px, 1.45vh, 14px);
  height: 100%;
  min-height: 0;
  padding: clamp(12px, 1.6vh, 16px) 28px;
  overflow: hidden;
}

.view.active[data-view="dashboard"] .stats-grid {
  gap: 12px;
}

.view.active[data-view="dashboard"] .stat-card {
  min-height: clamp(88px, 13vh, 108px);
  padding: 16px 18px;
}

.view.active[data-view="dashboard"] .stat-card strong {
  margin: 2px 0 5px;
  font-size: clamp(26px, 4vh, 32px);
}

.view.active[data-view="dashboard"] .dashboard-grid {
  min-height: 0;
  margin-top: 0;
}

.view.active[data-view="dashboard"] .dashboard-grid > .card {
  min-height: 0;
}

.view.active[data-view="dashboard"] .card-header {
  min-height: 46px;
  padding: 0 18px;
}

.view.active[data-view="dashboard"] .recent-list {
  min-height: 0;
  overflow: hidden;
}

.view.active[data-view="dashboard"] .recent-row {
  min-height: 50px;
  padding: 10px 18px;
}

.view.active[data-view="dashboard"] .hero-card {
  gap: 16px;
  min-height: 76px;
  margin-top: 0;
  padding: 16px 20px;
}

.view.active[data-view="dashboard"] .hero-mark {
  width: 50px;
  height: 50px;
  border-radius: 14px;
}

.view.active:has(#projectCreatePane:not(.hidden)) .project-create-pane {
  min-height: 0;
  height: 100%;
}

.view.active:has(.card-list-pane:not(.hidden)) .card-list-pane,
html[data-initial-view="templates"] .view[data-view="templates"] .card-list-pane,
html[data-initial-view="scaffolds"] .view[data-view="scaffolds"] .card-list-pane,
html[data-initial-view="projects"] .view[data-view="projects"] .card-list-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 0;
  height: 100%;
}

.view.active:has(.card-list-pane:not(.hidden)) .template-list-pane,
html[data-initial-view="templates"] .view[data-view="templates"] .template-list-pane {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.view.active:has(.card-list-pane:not(.hidden)) .scaffold-list-pane:has(#scaffoldCreateForm.visible),
html[data-initial-view="scaffolds"] .view[data-view="scaffolds"] .scaffold-list-pane:has(#scaffoldCreateForm.visible) {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.view.active:has(.card-list-pane:not(.hidden)) .resource-card-grid,
html[data-initial-view="templates"] .view[data-view="templates"] .resource-card-grid,
html[data-initial-view="scaffolds"] .view[data-view="scaffolds"] .resource-card-grid,
html[data-initial-view="projects"] .view[data-view="projects"] .resource-card-grid,
.view.active:has(.card-list-pane:not(.hidden)) .scaffold-card-grid,
html[data-initial-view="templates"] .view[data-view="templates"] .scaffold-card-grid,
html[data-initial-view="scaffolds"] .view[data-view="scaffolds"] .scaffold-card-grid,
html[data-initial-view="projects"] .view[data-view="projects"] .scaffold-card-grid {
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.view.active:has(.card-list-pane:not(.hidden)) .card-pagination,
html[data-initial-view="templates"] .view[data-view="templates"] .card-pagination,
html[data-initial-view="scaffolds"] .view[data-view="scaffolds"] .card-pagination,
html[data-initial-view="projects"] .view[data-view="projects"] .card-pagination {
  flex: 0 0 auto;
}

.project-create-panel {
  background: linear-gradient(180deg, rgba(8, 17, 23, 0.98), rgba(6, 13, 18, 0.98));
  border: 1px solid rgba(255, 138, 0, 0.28);
  border-radius: 18px;
}

.project-create-body {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) auto;
  gap: 14px;
  padding: 22px 24px 24px;
}

.scaffold-upload-panel {
  display: none;
  background: linear-gradient(180deg, rgba(8, 17, 23, 0.98), rgba(6, 13, 18, 0.98));
  border: 1px solid rgba(255, 138, 0, 0.28);
  border-radius: 18px;
}

.scaffold-upload-panel.visible {
  display: block;
}

.card-header.flush {
  border-bottom: 1px solid var(--line);
}

.scaffold-upload-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.scaffold-upload-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 22px 24px 24px;
}

.scaffold-upload-actions {
  grid-column: span 3;
  display: flex;
  justify-content: flex-end;
}

.scaffold-upload-actions button {
  width: auto;
  min-width: 210px;
  padding: 0 24px;
}

.toolbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 10px;
}

.toolbar-toggle-action,
.primary-action.compact.toolbar-toggle-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  gap: 0;
  border: 1px solid var(--accent);
  border-radius: 11px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transition: filter 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.primary-action.compact.toolbar-toggle-action.is-close,
.toolbar-toggle-action.is-close,
.toolbar-toggle-close {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  color: #ffffff;
  background: linear-gradient(180deg, #ef4444, #cc3333);
  border-color: rgba(255, 118, 118, 0.72);
  border-radius: 11px;
  box-shadow: 0 10px 22px rgba(209, 59, 59, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.toolbar-toggle-x {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.toolbar-toggle-x::before,
.toolbar-toggle-x::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transform-origin: center;
}

.toolbar-toggle-x::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.toolbar-toggle-x::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.primary-action.compact.toolbar-toggle-action.is-close:hover,
.toolbar-toggle-action.is-close:hover,
.toolbar-toggle-close:hover {
  color: #ffffff;
  background: linear-gradient(180deg, #f15a5a, #d93c3c);
  border-color: rgba(255, 150, 150, 0.9);
  filter: none;
}

.resource-card-grid,
.scaffold-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: max-content;
  gap: 8px;
}

.card-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 44px;
  color: var(--muted);
}

.file-pagination {
  margin-top: 14px;
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.pagination-controls span {
  min-width: 92px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.scaffold-card {
  display: grid;
  align-self: start;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-areas: "mark main side";
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(8, 17, 23, 0.98), rgba(5, 13, 18, 0.98));
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.scaffold-card.has-actions {
  grid-template-columns: 40px minmax(0, 1fr) auto minmax(312px, 372px);
  grid-template-areas: "mark main side actions";
}

.scaffold-card:hover,
.scaffold-card.selected {
  border-color: rgba(255, 138, 0, 0.64);
}

.scaffold-card:hover {
  transform: translateY(-1px);
}

.template-card {
  cursor: default;
}

.template-card:hover {
  transform: none;
}

.template-card .resource-card-title-line {
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.template-card .resource-card-title-line h3 {
  flex: 0 0 auto;
  max-width: 100%;
}

.template-card .resource-card-title-line p {
  flex: 0 1 auto;
  max-width: 100%;
}

.template-robot-summary-shell {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
}

.template-robot-summary {
  min-height: 24px;
  max-width: 170px;
  padding: 3px 8px;
  overflow: hidden;
  color: #ffcf9a;
  background: rgba(255, 138, 0, 0.12);
  border: 1px solid rgba(255, 138, 0, 0.34);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-robot-summary:hover,
.template-robot-summary:focus-visible {
  color: #ffffff;
  border-color: rgba(255, 178, 84, 0.74);
  outline: none;
}

.template-robot-popover {
  position: fixed;
  left: var(--template-robot-popover-left, 12px);
  top: var(--template-robot-popover-top, 12px);
  z-index: 1000;
  display: none;
  width: min(460px, calc(100vw - 24px));
  max-height: min(520px, calc(100dvh - 24px));
  overflow: auto;
  padding: 12px;
  color: var(--text);
  background: #050d12;
  border: 1px solid rgba(255, 138, 0, 0.58);
  border-radius: 8px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.52);
}

.template-robot-summary-shell:hover .template-robot-popover,
.template-robot-summary-shell:focus-within .template-robot-popover,
.template-robot-summary-shell.is-open .template-robot-popover {
  display: grid;
  gap: 7px;
}

.template-robot-popover > strong {
  color: #ffffff;
  font-size: 13px;
}

.template-robot-popover-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px 14px;
}

.template-robot-popover-grid > div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.template-robot-popover-grid > div strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-robot-popover-section {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.template-robot-popover-section > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.template-robot-popover-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-robot-popover-options span,
.template-robot-popover-options em {
  max-width: 100%;
  padding: 3px 7px;
  overflow: hidden;
  color: #d6dde5;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-robot-popover-options span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.template-robot-popover-options small {
  color: #ffcf9a;
  font-size: 10px;
  font-weight: 700;
}

.template-robot-popover p {
  display: grid;
  gap: 3px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.template-robot-popover p strong {
  color: var(--text);
  font-size: 12px;
}

.scaffold-card-footer,
.scaffold-detail-actions,
.files-panel-header,
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.compact-mark {
  grid-area: mark;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.compact-mark svg,
.compact-mark img {
  width: 22px;
  height: 22px;
}

.resource-card-main {
  grid-area: main;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.resource-card-title-line,
.resource-card-detail-line {
  display: flex;
  align-items: center;
  min-width: 0;
}

.resource-card-title-line {
  gap: 12px;
}

.resource-card-detail-line {
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 10px;
  color: #58a6ff;
  background: rgba(21, 92, 175, 0.26);
  border: 1px solid rgba(88, 166, 255, 0.45);
  border-radius: 999px;
  font-size: 14px;
}

.scaffold-card h3 {
  flex: 0 1 auto;
  overflow: hidden;
  min-width: 120px;
  max-width: 42%;
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scaffold-card.selected h3 {
  color: var(--accent);
}

.scaffold-card p {
  overflow: hidden;
  flex: 1 1 220px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  min-width: 0;
}

.tag-row span {
  overflow: hidden;
  min-height: 22px;
  max-width: 160px;
  padding: 3px 8px;
  color: #d6dde5;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scaffold-description-line {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 8px;
  min-width: 0;
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.scaffold-description-line span {
  flex: 0 0 auto;
  padding-top: 1px;
  color: var(--muted-2);
}

.scaffold-description-line strong {
  display: block;
  overflow: hidden;
  min-width: 0;
  color: #cdd5dc;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: anywhere;
}

.resource-card-side {
  grid-area: side;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.scaffold-card-footer {
  align-self: center;
  margin-top: 0;
  padding-top: 0;
  color: var(--muted);
  border-top: 0;
  font-size: 12px;
  white-space: nowrap;
}

.resource-card-footer {
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.resource-card-footer > span {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
}

.scaffold-card.selected .scaffold-card-footer span:last-child {
  color: var(--accent);
}

.resource-card-actions,
.template-card-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: minmax(110px, 0.85fr) minmax(118px, 1fr) minmax(74px, 0.72fr);
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.resource-card-actions:empty {
  display: none;
}

.resource-card-actions select,
.resource-card-actions button,
.template-card-actions select,
.template-card-actions button {
  width: 100%;
  min-height: 34px;
}

.scaffold-detail-pane {
  margin: -14px -28px -30px;
  overflow: hidden;
  background: var(--bg);
  border: 0;
  outline: 0;
}

.entity-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 8, 12, 0.72);
}

.entity-detail-header .title-group {
  flex: 1 1 240px;
  min-width: 0;
}

.entity-detail-header .title-group > div:last-child {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 10px;
}

.entity-detail-header h2 {
  overflow: hidden;
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-detail-header p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-detail-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 34px;
}

.scaffold-detail-header {
  gap: 14px;
}

.scaffold-detail-header .title-group {
  flex: 1 1 auto;
}

.entity-detail-actions .status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  height: 24px;
  min-height: 24px;
  padding: 0 9px;
  font-size: 12px;
  line-height: 1;
}

.entity-detail-actions select {
  width: 138px;
  min-height: 34px;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  line-height: 34px;
}

.scaffold-detail-actions {
  flex-wrap: nowrap;
  gap: 8px;
}

.scaffold-detail-actions select {
  flex: 0 0 112px;
  width: 112px;
}

#scaffoldVisibilitySelect {
  flex: 0 0 82px;
}

.scaffold-actions-control,
.template-actions-control,
.project-actions-control {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
}

.entity-detail-actions .scaffold-action-menu-button,
.entity-detail-actions .template-action-menu-button,
.entity-detail-actions .project-action-menu-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

.scaffold-action-menu-button:hover,
.scaffold-action-menu-button[aria-expanded="true"],
.template-action-menu-button:hover,
.template-action-menu-button[aria-expanded="true"],
.project-action-menu-button:hover,
.project-action-menu-button[aria-expanded="true"] {
  color: #ffffff;
  background: rgba(255, 138, 0, 0.08);
  border-color: rgba(255, 138, 0, 0.42);
}

.scaffold-action-dots,
.detail-action-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.scaffold-action-dots span,
.detail-action-dots span {
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 999px;
}

.scaffold-actions-menu,
.template-actions-menu,
.project-actions-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  display: grid;
  gap: 2px;
  min-width: 132px;
  padding: 6px;
  background: #071017;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42);
}

.scaffold-actions-menu button,
.template-actions-menu button,
.project-actions-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.scaffold-actions-menu button:hover,
.scaffold-actions-menu button:focus-visible,
.template-actions-menu button:hover,
.template-actions-menu button:focus-visible,
.project-actions-menu button:hover,
.project-actions-menu button:focus-visible {
  color: #ffffff;
  background: rgba(255, 138, 0, 0.16);
  outline: none;
}

.scaffold-actions-menu button.danger,
.template-actions-menu button.danger,
.project-actions-menu button.danger {
  color: #ff9b9b;
}

.project-actions-menu button.primary {
  color: var(--text);
}

.scaffold-actions-menu button:disabled,
.template-actions-menu button:disabled,
.project-actions-menu button:disabled {
  color: var(--muted-2);
  cursor: not-allowed;
  opacity: 0.45;
}

.entity-detail-actions .ghost-action,
.entity-detail-actions .primary-action {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
}

.entity-detail-actions .scaffold-action-menu-button,
.entity-detail-actions .template-action-menu-button,
.entity-detail-actions .project-action-menu-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.danger-action {
  color: #ff7b7b;
  border-color: rgba(255, 93, 93, 0.34);
}

.danger-action:hover {
  color: #ffd4d4;
  background: rgba(255, 93, 93, 0.12);
  border-color: rgba(255, 93, 93, 0.55);
}

.scaffold-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  min-height: calc(100vh - 56px);
  border-top: 0;
}

.view.active:has(#scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="files"]),
.view.active:has(#scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]) {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.scaffold-detail-pane:has(.scaffold-tab-panel.active[data-scaffold-panel="files"]),
.scaffold-detail-pane:has(.scaffold-tab-panel.active[data-scaffold-panel="rules"]) {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.scaffold-detail-layout:has(.scaffold-tab-panel.active[data-scaffold-panel="files"]),
.scaffold-detail-layout:has(.scaffold-tab-panel.active[data-scaffold-panel="rules"]) {
  height: calc(100vh - 56px);
  min-height: 0;
  overflow: hidden;
}

.project-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  min-height: calc(100vh - 56px);
  border-top: 0;
}

.project-detail-layout > .scaffold-files-panel {
  grid-column: 1;
  grid-row: 1;
}

.project-detail-layout > .scaffold-detail-sidebar {
  grid-column: 2;
  grid-row: 1;
}

.scaffold-detail-layout.rules-active {
  grid-template-columns: minmax(0, 1fr);
}

.project-detail-layout.rules-active {
  grid-template-columns: minmax(0, 1fr);
}

.scaffold-detail-layout.rules-active .scaffold-detail-sidebar {
  display: none;
}

.project-detail-layout.rules-active .scaffold-detail-sidebar {
  display: none;
}

.scaffold-detail-sidebar {
  padding: 22px 28px 28px 20px;
  border-left: 1px solid var(--line);
}

.scaffold-detail-sidebar h3,
.files-panel-header h3 {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.06em;
}

.scaffold-detail-sidebar section + section {
  margin-top: 22px;
}

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

.metadata-list div {
  display: grid;
  grid-template-columns: 20px 78px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.metadata-list .metadata-description {
  align-items: start;
}

.metadata-list .metadata-description .meta-icon,
.metadata-list .metadata-description span:nth-child(2) {
  margin-top: 2px;
}

.metadata-list .metadata-description strong {
  white-space: normal;
  overflow-wrap: anywhere;
}

.metadata-list strong {
  color: var(--text);
  font-weight: 500;
}

.project-summary-list,
.project-stat-list {
  display: grid;
  gap: 9px;
}

.project-summary-list div,
.project-stat-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.project-summary-list strong,
.project-stat-list strong {
  color: var(--text);
  font-weight: 700;
}

.project-overview-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1fr);
  gap: 16px;
}

.project-insight-card {
  min-width: 0;
  padding: 18px;
  background: rgba(5, 13, 18, 0.9);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.project-insight-card h3 {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.06em;
}

.recent-project-row {
  width: 100%;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.recent-project-row:hover .row-title {
  color: var(--accent);
}

.meta-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.tag-icon::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 4px;
  transform: rotate(45deg);
}

.calendar-icon::before {
  content: "";
  position: absolute;
  inset: 4px 3px 3px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.calendar-icon::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 8px;
  height: 2px;
  background: currentColor;
}

.role-filter-list,
.sample-group-list {
  display: grid;
  gap: 8px;
}

.role-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
}

.role-filter strong {
  min-width: 30px;
  padding: 1px 7px;
  color: #f2f5f8;
  background: var(--surface-3);
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.role-filter.active {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.12);
}

.role-filter.active strong {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.18);
}

.role-filter.group-filter {
  width: calc(100% - 22px);
  min-height: 30px;
  margin-left: 22px;
  padding-left: 14px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.018);
}

.role-filter.group-filter span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 1px;
  margin-right: 8px;
  vertical-align: middle;
  background: rgba(139, 151, 160, 0.75);
}

.role-filter.group-filter strong {
  min-width: 24px;
  font-size: 12px;
}

.role-filter.group-filter.active {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.09);
}

.mini-plus {
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 26px;
}

.sample-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
  text-align: left;
}

.sample-group .folder-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: #ffd000;
}

.muted-note {
  color: var(--muted);
}

.scaffold-files-panel {
  min-width: 0;
  padding: 12px 24px 16px;
}

.scaffold-detail-layout:has(.scaffold-tab-panel.active[data-scaffold-panel="files"]) .scaffold-files-panel,
.scaffold-detail-layout:has(.scaffold-tab-panel.active[data-scaffold-panel="rules"]) .scaffold-files-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.scaffold-workbench-tabs {
  display: inline-flex;
  gap: 6px;
  margin: 0;
  padding: 5px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.scaffold-workbench-tabs button {
  min-height: 30px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.scaffold-workbench-tabs button.active {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.12);
  border-color: rgba(255, 138, 0, 0.26);
}

.scaffold-tab-panel {
  display: none;
}

.scaffold-tab-panel.active {
  display: block;
}

.scaffold-tab-panel.active[data-scaffold-panel="files"] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.scaffold-tab-panel.active[data-scaffold-panel="rules"] {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.files-panel-header {
  margin-bottom: 14px;
}

.files-panel-header h3 {
  margin-bottom: 0;
}

.files-panel-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.file-pagination-top {
  justify-content: flex-end;
  min-height: 32px;
  margin: 0;
}

.file-pagination-top .pagination-controls {
  gap: 8px;
}

.file-pagination-top .pagination-controls span {
  min-width: 72px;
  font-size: 12px;
}

.file-pagination-top .ghost-action.compact {
  min-height: 30px;
  padding: 0 10px;
}

.scaffold-detail-files {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
  align-content: start;
  padding-right: 0;
}

.scaffold-file-row {
  display: grid;
  grid-template-columns: 28px minmax(320px, 1fr) 150px 170px;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.file-context-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-context-check input {
  width: 16px;
  height: 16px;
  min-height: 0;
  accent-color: var(--accent);
}

.file-doc-icon {
  color: var(--muted);
}

.file-main {
  min-width: 0;
}

.file-preview-trigger {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.file-preview-trigger:hover .file-name {
  color: var(--accent);
}

.file-name {
  overflow: hidden;
  color: #ffffff;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.25;
}

.file-path {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.25;
}

.scaffold-file-row select,
.scaffold-file-row input[data-file-group] {
  width: 100%;
  min-height: 34px;
  height: 34px;
  padding: 0 10px;
  color: #ffffff;
  background: var(--surface);
  border-radius: 9px;
  font-size: 12px;
}

.scaffold-file-row input[data-file-group]:disabled {
  color: var(--muted);
  opacity: 0.55;
}

.file-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.file-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(10px);
}

#filePreviewModal.is-floating-window.code-preview-mode,
#filePreviewModal.file-preview-window.is-floating-window.code-preview-mode,
.file-preview-window.is-floating-window.code-preview-mode,
#ruleFileEditorModal.is-floating-window {
  pointer-events: none;
}

#filePreviewModal.is-floating-window.code-preview-mode .file-preview-backdrop,
#filePreviewModal.file-preview-window.is-floating-window.code-preview-mode .file-preview-backdrop,
.file-preview-window.is-floating-window.code-preview-mode .file-preview-backdrop,
#ruleFileEditorModal.is-floating-window .file-preview-backdrop {
  display: none;
}

.file-preview-dialog.is-draggable-window {
  margin: 0;
  pointer-events: auto;
}

.file-preview-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, 100%);
  height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 17, 23, 0.98), rgba(4, 10, 15, 0.98));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.file-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.file-preview-header h2 {
  margin: 0;
  font-size: 18px;
}

.file-preview-header p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.file-preview-modal.code-preview-mode .file-preview-heading {
  display: none;
}

.file-preview-modal.code-preview-mode .file-preview-header {
  display: none;
}

.file-preview-modal.code-preview-mode .file-preview-dialog {
  grid-template-rows: minmax(0, 1fr);
  width: min(var(--editor-dialog-width), 100%);
  background: var(--editor-bg);
}

.file-preview-dialog.is-draggable-window .code-editor-toolbar,
.file-preview-modal.markdown-preview-mode .markdown-preview-tabs {
  cursor: move;
}

.rule-file-editor-dialog {
  grid-template-rows: minmax(0, 1fr);
  width: min(var(--editor-dialog-width), 100%);
  background: var(--editor-bg);
}

.rule-file-editor-dialog > .file-preview-header {
  display: none;
}

#filePreviewContent {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: var(--editor-bg);
  color: #17212b;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: none;
}

.code-editor-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #f8fafc;
}

.file-encoding-badge {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 6;
  pointer-events: none;
  padding: 3px 7px;
  color: #475569;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
}

.file-encoding-badge.hidden {
  display: none;
}

.robo-code-editor {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #f8fafc;
}

.robo-code-editor.has-symbol-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.code-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 8px 10px;
  background: #f1f5f9;
  border-bottom: 1px solid rgba(100, 116, 139, 0.2);
}

.code-editor-meta {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}

.code-editor-meta strong,
.code-editor-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-editor-meta strong {
  color: #17212b;
  font: 700 12px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.code-editor-meta span {
  color: #64748b;
  font-size: 11px;
}

.code-editor-actions {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}

.code-editor-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.code-editor-action-group.is-tools {
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.code-editor-action-group.is-write {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  order: 100;
}

.code-editor-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  color: #475569;
  background: #ffffff;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.code-editor-button.icon-only {
  width: 30px;
  padding: 0;
}

.code-editor-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.code-editor-button-label {
  line-height: 1;
}

.code-editor-button:hover,
.code-editor-button.active {
  color: #17212b;
  border-color: rgba(234, 88, 12, 0.44);
}

.code-editor-button.success {
  color: #166534;
  border-color: rgba(22, 101, 52, 0.36);
}

.code-editor-button.primary {
  color: #101820;
  background: var(--accent);
  border-color: var(--accent);
}

.code-editor-button.danger {
  color: #ffffff;
  background: #dc2626;
  border-color: #dc2626;
}

.code-editor-button.danger:hover {
  color: #ffffff;
  background: #b91c1c;
  border-color: #b91c1c;
}

.code-editor-button.is-close {
  order: 100;
}

.code-editor-button.is-revert {
  order: 10;
}

.code-editor-button.is-save {
  order: 20;
}

.code-editor-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.large-text-viewer {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #17212b;
  background: #f8fafc;
}

.large-text-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  background: #eef2f7;
  border-bottom: 1px solid rgba(100, 116, 139, 0.22);
}

.large-text-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.large-text-title strong,
.large-text-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.large-text-title strong {
  font: 700 12px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.large-text-meta,
.large-text-status {
  color: #64748b;
  font-size: 11px;
}

.large-text-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  min-width: min(520px, 58%);
}

.large-text-goto {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.large-text-goto-input,
.large-text-search-input {
  height: 28px;
  min-width: 0;
  padding: 0 8px;
  color: #17212b;
  background: #ffffff;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 8px;
  font-size: 12px;
}

.large-text-goto-input {
  width: 86px;
}

.large-text-search-input {
  width: min(180px, 24vw);
}

.large-text-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  padding: 5px 10px;
  background: #ffffff;
  border-bottom: 1px solid rgba(100, 116, 139, 0.16);
}

.large-text-encoding {
  flex: 0 0 auto;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #475569;
}

.large-text-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #ffffff;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.large-text-line {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  min-height: 20px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.75);
}

.large-text-line span {
  position: sticky;
  left: 0;
  padding: 1px 10px 1px 8px;
  color: #64748b;
  text-align: right;
  user-select: none;
  background: #f8fafc;
  border-right: 1px solid rgba(226, 232, 240, 0.9);
}

.large-text-line code {
  min-width: max-content;
  padding: 1px 10px;
  color: #1f2937;
  white-space: pre;
}

.large-text-line.is-match {
  background: #fff7ed;
}

.large-text-line.is-match code {
  color: #9a3412;
  font-weight: 700;
}

@media (max-width: 760px) {
  .large-text-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .large-text-controls {
    justify-content: flex-start;
    min-width: 0;
  }

  .large-text-search-input {
    width: min(100%, 220px);
  }

  .large-text-line {
    grid-template-columns: 54px minmax(0, 1fr);
  }
}

.code-editor-symbol-panel {
  min-width: 0;
  padding: 6px 10px;
  background: #eef3f7;
  border-bottom: 1px solid rgba(100, 116, 139, 0.18);
}

.code-editor-symbol-panel.hidden {
  display: none;
}

.code-editor-symbol-list {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.code-editor-symbol-item {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  min-height: 28px;
  max-width: 260px;
  padding: 0 8px;
  color: #17212b;
  background: #ffffff;
  border: 1px solid rgba(100, 116, 139, 0.24);
  border-radius: 7px;
  box-shadow: none;
}

.code-editor-symbol-item span,
.code-editor-symbol-item small {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.code-editor-symbol-item strong {
  overflow: hidden;
  color: #17212b;
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-editor-symbol-item:hover,
.code-editor-symbol-item:focus-visible {
  border-color: rgba(234, 88, 12, 0.44);
  outline: none;
}

.code-editor-symbol-empty {
  color: #64748b;
  font-size: 12px;
}

.code-editor-find-results-window {
  position: fixed;
  z-index: 401;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 320px;
  min-height: 220px;
  overflow: hidden;
  color: #17212b;
  background: #f8fafc;
  border: 1px solid rgba(100, 116, 139, 0.34);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22);
}

.code-editor-find-results-titlebar {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 10px;
  user-select: none;
  cursor: move;
  background: #eef3f7;
  border-bottom: 1px solid rgba(100, 116, 139, 0.24);
}

.code-editor-find-results-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: #475569;
  background: #ffffff;
  border: 1px solid rgba(100, 116, 139, 0.32);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.code-editor-find-results-close:hover,
.code-editor-find-results-close:focus-visible {
  color: #17212b;
  border-color: rgba(234, 88, 12, 0.44);
  outline: none;
}

.code-editor-find-results-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.code-editor-find-results-title strong,
.code-editor-find-results-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-editor-find-results-title strong {
  color: #17212b;
  font-size: 12px;
  font-weight: 800;
}

.code-editor-find-results-title span {
  color: #64748b;
  font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.code-editor-find-results-body {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #f8fafc;
  scrollbar-width: thin;
}

.code-editor-find-results-list {
  display: grid;
  gap: 1px;
  padding: 6px;
}

.code-editor-find-result-item {
  display: grid;
  grid-template-columns: minmax(88px, auto) minmax(96px, 0.5fr) minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  color: #17212b;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.code-editor-find-result-item:hover,
.code-editor-find-result-item:focus-visible {
  background: #ffffff;
  border-color: rgba(234, 88, 12, 0.34);
  outline: none;
}

.code-editor-find-result-location {
  color: #9a3412;
  font: 800 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

.code-editor-find-result-path {
  overflow: hidden;
  color: #64748b;
  font: 600 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-editor-find-result-summary {
  overflow: hidden;
  color: #17212b;
  font: 600 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-editor-find-results-empty {
  padding: 22px;
  color: #64748b;
  font-size: 12px;
}

.code-editor-find-results-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
}

.code-editor-find-results-resize::before,
.code-editor-find-results-resize::after {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 9px;
  height: 1px;
  content: "";
  background: rgba(100, 116, 139, 0.75);
  transform: rotate(-45deg);
}

.code-editor-find-results-resize::after {
  right: 3px;
  bottom: 8px;
  width: 14px;
}

.code-editor-context-menu {
  min-width: 148px;
}

.code-editor-host {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.code-editor-host .cm-editor {
  height: 100%;
}

.code-editor-shell,
.robo-code-editor {
  color: #17212b;
  background: var(--editor-bg);
}

.code-editor-toolbar {
  background: var(--editor-panel-bg);
  border-bottom-color: rgba(100, 116, 139, 0.24);
}

.code-editor-meta strong {
  color: #17212b;
}

.code-editor-meta span {
  color: #64748b;
}

.code-editor-button {
  color: #475569;
  background: #ffffff;
  border-color: rgba(100, 116, 139, 0.28);
}

.code-editor-button:hover,
.code-editor-button.active {
  color: #17212b;
  background: #f8fafc;
  border-color: rgba(234, 88, 12, 0.44);
}

.code-editor-button.primary {
  color: #101820;
  background: var(--accent);
  border-color: var(--accent);
}

.code-editor-host .cm-editor {
  color: #17212b !important;
  background: var(--editor-bg) !important;
}

.code-editor-host .cm-scroller {
  color: #17212b !important;
  background: var(--editor-bg) !important;
  scrollbar-color: rgba(148, 163, 184, 0.72) var(--editor-bg) !important;
  scrollbar-width: thin;
}

.code-editor-host .cm-content {
  caret-color: var(--editor-caret) !important;
}

.code-editor-host .cm-cursor,
.code-editor-host .cm-dropCursor {
  border-left-color: var(--editor-caret) !important;
}

.code-editor-host .cm-gutters {
  color: #64748b !important;
  background: var(--editor-gutter-bg) !important;
  border-right-color: rgba(100, 116, 139, 0.22) !important;
}

.code-editor-host .cm-activeLine,
.code-editor-host .cm-activeLineGutter {
  background-color: rgba(255, 138, 0, 0.1) !important;
}

.code-editor-host .cm-selectionBackground,
.code-editor-host .cm-content ::selection {
  background-color: rgba(37, 99, 235, 0.18) !important;
}

.code-editor-host .cm-panels,
.code-editor-host .cm-search,
.code-editor-host .cm-dialog {
  color: #17212b !important;
  background: var(--editor-panel-bg) !important;
  border-color: rgba(100, 116, 139, 0.24) !important;
}

.code-editor-host .cm-search input,
.code-editor-host .cm-dialog input.cm-textfield {
  color: #17212b !important;
  background: var(--editor-bg) !important;
  border-color: rgba(100, 116, 139, 0.34) !important;
}

.code-editor-host .cm-search label,
.code-editor-host .cm-dialog label {
  color: #475569 !important;
}

.code-editor-host .cm-button,
.code-editor-host .cm-search button[name=close],
.code-editor-host .cm-dialog-close {
  color: #475569 !important;
  background: #ffffff !important;
  border-color: rgba(100, 116, 139, 0.3) !important;
}

.code-editor-host .cm-scroller::-webkit-scrollbar {
  width: 12px;
  height: 12px;
  background-color: var(--editor-bg);
}

.code-editor-host .cm-scroller::-webkit-scrollbar-track {
  background-color: var(--editor-bg);
  border-left: 1px solid rgba(100, 116, 139, 0.16);
}

.code-editor-host .cm-scroller::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.58);
  border: 3px solid var(--editor-bg);
  border-radius: 999px;
}

.code-editor-host .cm-scroller::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 116, 139, 0.72);
}

.file-preview-modal.markdown-preview-mode .file-preview-dialog {
  grid-template-rows: auto minmax(0, 1fr);
  background: #f8fafc;
}

.markdown-preview-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  background: #edf2f7;
  border-bottom: 1px solid rgba(100, 116, 139, 0.24);
}

.markdown-preview-tabs.hidden {
  display: none;
}

.markdown-preview-tab-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 3px;
  background: #dbe4ee;
  border: 1px solid rgba(100, 116, 139, 0.24);
  border-radius: 8px;
}

.markdown-preview-tab {
  min-height: 28px;
  padding: 0 12px;
  color: #475569;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.markdown-preview-tab.active {
  color: #17212b;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.markdown-preview-tabs .code-editor-button {
  color: #475569;
  background: #ffffff;
  border-color: rgba(100, 116, 139, 0.28);
}

.markdown-preview-tabs .code-editor-button.danger {
  color: #ffffff;
  background: #dc2626;
  border-color: #dc2626;
}

.markdown-preview-tabs .code-editor-button.danger:hover {
  color: #ffffff;
  background: #b91c1c;
  border-color: #b91c1c;
}

.markdown-preview-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #17212b;
  background: #f8fafc;
}

.markdown-preview-shell.hidden {
  display: none;
}

.markdown-preview-body {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 22px 24px 32px;
  color: #17212b;
  background: #f8fafc;
  scrollbar-color: rgba(148, 163, 184, 0.7) #f8fafc;
  scrollbar-width: thin;
}

.markdown-preview-body::-webkit-scrollbar {
  width: 12px;
  height: 12px;
  background: #f8fafc;
}

.markdown-preview-body::-webkit-scrollbar-track {
  background: #f8fafc;
}

.markdown-preview-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.58);
  border: 3px solid #f8fafc;
  border-radius: 999px;
}

.markdown-preview-body .markdown-table-wrap {
  background: #ffffff;
  border-color: rgba(100, 116, 139, 0.24);
}

.markdown-preview-body.markdown-content table {
  color: #17212b;
}

.markdown-preview-body.markdown-content th,
.markdown-preview-body.markdown-content td {
  border-bottom-color: rgba(100, 116, 139, 0.18);
}

.markdown-preview-body.markdown-content th {
  color: #0f172a;
  background: #e2e8f0;
}

.markdown-preview-body.markdown-content code {
  color: #0f172a;
  background: #e2e8f0;
  border-color: rgba(100, 116, 139, 0.2);
}

#filePreviewEditor,
#agentGeneratedEditor {
  min-height: 0;
}

#filePreviewEditor,
#agentGeneratedEditor {
  height: 100%;
}

.scaffold-edit-dialog {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(720px, 100%);
  height: auto;
  max-height: calc(100vh - 48px);
}

.scaffold-edit-body {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  min-width: 0;
  overflow: auto;
  padding: 18px;
}

.scaffold-edit-body label {
  min-width: 0;
}

.scaffold-edit-body input,
.scaffold-edit-body select,
.scaffold-edit-body textarea {
  max-width: 100%;
}

.scaffold-edit-body textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 86px;
  max-height: 150px;
  padding: 12px 13px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
}

.scaffold-edit-body label:last-child,
.scaffold-edit-body .full-span {
  grid-column: 1 / -1;
}

.scaffold-edit-body input[readonly] {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
}

.scaffold-edit-actions {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
}

.edit-form-error {
  flex: 1 1 auto;
  min-width: 0;
  margin-right: auto;
  color: #ff8f8f;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
  white-space: pre-wrap;
}

.scaffold-edit-actions .ghost-action {
  min-width: 120px;
}

.scaffold-edit-actions .primary-action {
  min-width: 120px;
}

.rule-workbench {
  display: grid;
  gap: 16px;
  height: 100%;
  min-height: 0;
}

.rule-workbench-tabs {
  display: inline-flex;
  width: fit-content;
  padding: 5px;
  gap: 4px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.rule-workbench-tabs button {
  min-height: 34px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
}

.rule-workbench-tabs button.active {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.12);
}

.rule-workbench-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.rule-workbench-header h3 {
  margin: 0 0 6px;
}

.rule-workbench-header p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.rule-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
}

.rule-workbench-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.rule-workbench > .rule-workbench-layout[data-rule-workbench-panel="editor"] {
  display: none;
}

.rule-workbench > .rule-workbench-layout[data-rule-workbench-panel="editor"].active {
  display: grid;
}

.rule-workbench-layout.rules-agent-workspace {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: hidden;
}

.rule-browser-panel {
  display: none;
  grid-template-columns: minmax(220px, 0.88fr) minmax(210px, 0.72fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: stretch;
}

.rule-browser-panel.active {
  display: grid;
}

.rule-browser-header {
  grid-column: 1 / -1;
}

.rule-folder-panel,
.rule-editor-panel,
.rule-browser-column {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(5, 13, 18, 0.9);
}

.rule-browser-column {
  display: grid;
  align-content: start;
  gap: 12px;
}

.rule-browser-column.preview {
  grid-template-rows: auto minmax(360px, 1fr);
}

.rule-browser-files {
  display: grid;
  gap: 10px;
}

.rule-file-row {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 58px;
  padding: 11px 12px;
  color: var(--muted);
  text-align: left;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.rule-file-row:hover,
.rule-file-row.active {
  color: var(--text);
  border-color: rgba(255, 138, 0, 0.62);
  background: rgba(255, 138, 0, 0.08);
}

.rule-file-row span {
  color: inherit;
  font-weight: 700;
}

.rule-file-row small {
  color: var(--muted);
}

#ruleBrowserPreview {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--editor-bg);
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.rule-folder-panel {
  position: sticky;
  top: 14px;
  grid-row: 1 / span 2;
}

.rule-folder-panel .section-title-row {
  align-items: flex-start;
  margin-bottom: 12px;
}

.rule-folder-panel h3,
.rule-files-grid h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.rule-folder-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.rule-set-card {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--muted);
  text-align: left;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.rule-set-card:hover,
.rule-set-card.active {
  color: var(--text);
  border-color: rgba(255, 138, 0, 0.62);
  background: rgba(255, 138, 0, 0.08);
}

.rule-set-card strong {
  color: inherit;
  font-size: 14px;
}

.rule-set-card small {
  color: var(--muted);
  line-height: 1.4;
}

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

.rule-set-meta span {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
}

.project-agent-create-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(360px, 28vw, 480px);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px 20px;
  min-height: 0;
  margin-bottom: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.project-detail-header {
  grid-column: 1 / -1;
  grid-row: 1;
  margin: -12px -28px 0;
}

.project-detail-actions {
  max-width: 52%;
}

.project-agent-context-bar {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 8px;
  padding: 0;
}

.project-agent-context-bar button {
  white-space: nowrap;
}

#startProjectSession,
#confirmProjectSession {
  min-width: 112px;
}

.project-agent-context-bar .toolbar-toggle-action {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 9px;
}

.project-agent-context-bar .toolbar-toggle-x {
  width: 12px;
  height: 12px;
}

.project-agent-context-bar .toolbar-toggle-x::before,
.project-agent-context-bar .toolbar-toggle-x::after {
  width: 13px;
}

.project-agent-context-bar .chip {
  justify-content: center;
  min-height: 42px;
  white-space: nowrap;
}

.project-session-layout {
  display: contents;
}

.project-session-chat {
  grid-column: 1;
  grid-row: 3;
  min-height: 0;
  padding: 0;
}

.project-session-chat {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.project-session-messages {
  display: grid;
  align-content: start;
  gap: var(--agent-chat-gap);
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 0 6px 0 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 139, 153, 0.46) transparent;
  scrollbar-gutter: stable;
}

.project-session-messages::-webkit-scrollbar {
  width: 6px;
}

.project-session-messages::-webkit-scrollbar-track {
  background: transparent;
}

.project-session-messages::-webkit-scrollbar-thumb {
  background: rgba(122, 139, 153, 0.38);
  border-radius: 999px;
}

.project-session-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(154, 171, 186, 0.62);
}

.project-session-composer {
  display: block;
}

.project-composer-shell {
  display: grid;
  grid-template-rows: minmax(var(--agent-input-min-height), 1fr) auto;
  min-height: var(--agent-composer-min-height);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(10, 21, 29, 0.98), rgba(3, 9, 13, 0.98)),
    #02070b;
  border: 1px solid rgba(130, 146, 158, 0.22);
  border-radius: 18px;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.project-composer-shell:has(.agent-interaction-pending:not(.hidden)) {
  grid-template-rows: auto minmax(80px, 1fr) auto auto;
}

.project-composer-shell:focus-within {
  border-color: rgba(255, 138, 0, 0.62);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 138, 0, 0.18),
    0 0 0 5px rgba(255, 138, 0, 0.07);
}

.project-composer-shell textarea {
  min-height: var(--agent-input-min-height);
  width: 100%;
  padding: var(--agent-input-padding);
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: 0;
  resize: vertical;
  font-size: 15px;
  line-height: 1.58;
}

.project-composer-shell textarea::placeholder {
  color: rgba(147, 160, 170, 0.82);
}

.project-upload-progress {
  display: grid;
  gap: 7px;
  padding: 0 18px 10px;
  color: var(--muted);
  font-size: 12px;
}

.project-upload-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-upload-progress-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-upload-progress-label strong {
  color: var(--text);
  font-weight: 800;
}

.project-upload-progress-track {
  overflow: hidden;
  height: 5px;
  background: rgba(130, 146, 158, 0.14);
  border-radius: 999px;
}

.project-upload-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 138, 0, 0.78), #ffb45f);
  border-radius: inherit;
  transition: width 140ms ease;
}

.project-upload-progress.is-error {
  color: #ff9b9b;
}

.project-upload-progress.is-error .project-upload-progress-track span {
  background: #ff5d5d;
}

.project-composer-context {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 132px;
  width: 132px;
  min-height: 34px;
  max-width: 132px;
  gap: 8px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(130, 146, 158, 0.07);
  border: 1px solid rgba(130, 146, 158, 0.16);
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.project-composer-context .context-budget-label {
  flex: 0 0 auto;
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-overflow: ellipsis;
}

.project-composer-context.warn .context-budget-label {
  color: #ffca74;
}

.project-composer-context.danger .context-budget-label {
  color: #ff8a82;
}

.context-budget-meter {
  display: block;
  flex: 0 0 44px;
  height: 7px;
  overflow: hidden;
  background: rgba(142, 154, 165, 0.18);
  border-radius: 999px;
}

.context-budget-meter span {
  display: block;
  height: 100%;
  background: #5aa9ff;
  border-radius: inherit;
  transition: width 140ms ease;
}

.context-budget-meter.warn span {
  background: #ffb347;
}

.context-budget-meter.danger span {
  background: #ff6961;
}

.project-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 8px 10px 10px 18px;
  border-top: 1px solid rgba(130, 146, 158, 0.12);
}

.project-composer-tools {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.project-composer-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--muted);
  background: rgba(130, 146, 158, 0.08);
  border: 1px solid rgba(130, 146, 158, 0.18);
  border-radius: 999px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}

.rule-agent-upload-status {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  justify-content: flex-start;
  text-overflow: ellipsis;
}

.rule-agent-upload-status:empty {
  display: none;
}

.rule-agent-upload-status.is-error {
  color: #ff9b9b;
  border-color: rgba(255, 110, 110, 0.32);
}

.project-model-select {
  appearance: none;
  flex: 0 0 186px;
  width: 186px;
  min-width: 160px;
  min-height: 34px;
  padding: 0 34px 0 14px;
  color: #f4f7fa;
  background-color: rgba(10, 18, 24, 0.96);
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f4f7fa' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 13px center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
  border-color: rgba(130, 146, 158, 0.18);
  border-radius: 999px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
  color-scheme: dark;
}

.project-model-select option {
  color: #f4f7fa;
  background: #071017;
  font-weight: 650;
}

.project-model-select option:checked,
.project-model-select option:hover {
  color: #ffffff;
  background: #244d72;
}

.project-model-select:hover,
.project-model-select:focus {
  color: var(--text);
  background-color: rgba(255, 138, 0, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  border-color: rgba(255, 138, 0, 0.32);
}

.project-scaffold-select {
  flex: 1 1 220px;
  width: min(260px, 100%);
  min-width: 180px;
}

.project-interaction-mode-select {
  flex-basis: 122px;
  width: 122px;
  min-width: 112px;
}

.project-composer-tool:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 138, 0, 0.09);
  border-color: rgba(255, 138, 0, 0.34);
  transform: translateY(-1px);
}

.project-attach-icon {
  position: relative;
  width: 13px;
  height: 13px;
}

.project-attach-icon::before,
.project-attach-icon::after {
  position: absolute;
  content: "";
  background: currentColor;
  border-radius: 999px;
}

.project-attach-icon::before {
  left: 6px;
  top: 1px;
  width: 2px;
  height: 11px;
}

.project-attach-icon::after {
  left: 1px;
  top: 6px;
  width: 11px;
  height: 2px;
}

.project-composer-hint {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-send-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  background: #ff8a00;
  border: 1px solid rgba(255, 179, 84, 0.9);
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(255, 138, 0, 0.24);
}

.project-send-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #ff9a1f;
  box-shadow: 0 14px 32px rgba(255, 138, 0, 0.34);
}

.project-send-button:active:not(:disabled) {
  transform: translateY(0);
}

.project-send-button:disabled {
  cursor: default;
  color: rgba(255, 255, 255, 0.42);
  background: rgba(130, 146, 158, 0.16);
  border-color: rgba(130, 146, 158, 0.24);
  box-shadow: none;
}

.project-send-button.is-busy::after {
  position: absolute;
  width: 11px;
  height: 11px;
  content: "";
  background: currentColor;
  border-radius: 3px;
}

.project-send-button.is-busy {
  color: #f2f6f8;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 138, 0, 0.5);
  box-shadow: 0 0 0 4px rgba(255, 138, 0, 0.08);
}

.project-send-button.is-busy:hover {
  background: rgba(255, 138, 0, 0.16);
  border-color: rgba(255, 138, 0, 0.78);
}

.project-send-button.is-busy .project-send-icon {
  opacity: 0;
}

.project-send-icon {
  position: relative;
  width: 14px;
  height: 16px;
  transform: translateY(1px);
}

.project-send-icon::before {
  position: absolute;
  left: 6px;
  top: 2px;
  width: 2px;
  height: 13px;
  content: "";
  background: currentColor;
  border-radius: 999px;
}

.project-send-icon::after {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 8px;
  height: 8px;
  content: "";
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-radius: 1px;
  transform: rotate(45deg);
}

.project-session-preview {
  grid-column: 2;
  grid-row: 3;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.project-session-preview section,
.project-session-proposal {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.project-session-preview section {
  padding: 12px;
}

.project-session-preview h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.project-session-preview section {
  min-height: 0;
  overflow: auto;
}

.project-session-preview .draft-file-browser-section,
.project-session-preview .project-detail-working-section {
  display: grid;
  min-height: 0;
}

.project-session-preview .draft-file-browser-section {
  grid-template-rows: minmax(0, 1fr);
  padding: 8px;
  overflow: hidden;
}

.project-session-preview .project-detail-working-section {
  grid-template-rows: auto minmax(0, 1fr);
}

.project-session-context-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  max-height: 260px;
  transition: max-height 180ms ease, border-color 180ms ease, background 180ms ease;
}

.project-session-context-card.is-collapsed {
  grid-template-rows: auto 0fr;
  gap: 0;
  max-height: 56px;
  overflow: hidden;
  background: rgba(255, 138, 0, 0.035);
  border-color: rgba(255, 138, 0, 0.22);
}

.session-context-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: left;
}

.session-context-toggle:hover:not(:disabled) {
  color: var(--text);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.session-context-toggle:focus-visible {
  outline: 0;
}

.project-session-context-card:has(.session-context-toggle:focus-visible) {
  border-color: rgba(255, 138, 0, 0.52);
  box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.1);
}

.session-context-toggle span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.session-context-toggle strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-context-toggle em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-context-toggle i {
  position: relative;
  display: inline-grid;
  place-items: center;
  justify-self: end;
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: rgba(130, 146, 158, 0.08);
  border: 1px solid rgba(130, 146, 158, 0.14);
  border-radius: 999px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 180ms ease;
}

.session-context-toggle:hover i {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.09);
  border-color: rgba(255, 138, 0, 0.28);
}

.session-context-toggle i::before {
  width: 7px;
  height: 7px;
  content: "";
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
}

.project-session-context-card.is-collapsed .session-context-toggle i {
  transform: rotate(-90deg);
}

.project-session-proposal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: stretch;
  align-content: stretch;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.project-session-context {
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
  transition: opacity 160ms ease;
}

.project-session-context-card.is-collapsed .project-session-context {
  opacity: 0;
}

.project-session-context .project-context-row,
.project-composer-context .context-usage-row,
.context-usage-panel .context-usage-row,
.proposal-file-list div,
.proposal-file-list button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.project-context-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
}

.project-context-row span {
  color: var(--muted);
}

.project-session-context strong,
.context-usage-panel strong,
.proposal-file-list strong {
  flex: 1;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-context-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding-top: 4px;
}

.project-context-stats span {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 7px 6px;
  background: rgba(130, 146, 158, 0.055);
  border: 1px solid rgba(130, 146, 158, 0.12);
  border-radius: 9px;
}

.project-context-stats em {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 11px;
  font-style: normal;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-context-stats strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proposal-file-list button {
  width: 100%;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(142, 154, 165, 0.18);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.proposal-file-list button:hover {
  background: rgba(255, 145, 0, 0.08);
  border-color: rgba(255, 145, 0, 0.45);
  transform: translateY(-1px);
}

.proposal-file-list span {
  min-width: 42px;
  padding: 3px 7px;
  color: var(--accent);
  background: rgba(255, 145, 0, 0.12);
  border-radius: 999px;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
}

.proposal-file-list em {
  color: var(--muted);
  font-style: normal;
  white-space: nowrap;
}

.primary-ghost {
  color: #05090b;
  background: var(--accent);
  border-color: var(--accent);
}

.project-session-context strong {
  text-align: right;
  white-space: normal;
}

.context-usage-panel {
  display: grid;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(142, 154, 165, 0.16);
}

.context-usage-panel:empty {
  display: none;
}

.project-session-context .context-meter,
.project-composer-context .context-meter,
.context-usage-panel .context-meter {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  background: rgba(142, 154, 165, 0.18);
  border-radius: 999px;
}

.context-meter span {
  display: block;
  height: 100%;
  min-width: 3px;
  background: #5aa9ff;
  border-radius: inherit;
}

.context-meter.warn span {
  background: #ffb347;
}

.context-meter.danger span {
  background: #ff6961;
}

.context-usage-row.ok strong {
  color: #9fd2ff;
}

.context-usage-row.warn strong {
  color: #ffca74;
}

.context-usage-row.danger strong {
  color: #ff8a82;
}

.project-agent-card {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.project-agent-card span,
.proposal-summary span,
.proposal-file-list span,
.proposal-question-list span {
  padding: 3px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
}

.project-session-file-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(130, 146, 158, 0.14);
}

.project-session-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 7px 6px 9px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(130, 146, 158, 0.14);
  border-radius: 10px;
}

.project-session-file-row div {
  min-width: 0;
}

.project-session-file-row strong,
.project-session-file-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-session-file-row strong {
  color: var(--text);
  font-size: 12px;
}

.project-session-file-row span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.project-session-file-row .icon-action {
  width: 26px;
  height: 26px;
  min-height: 26px;
  color: var(--muted);
  background: rgba(130, 146, 158, 0.08);
  border: 1px solid rgba(130, 146, 158, 0.16);
  border-radius: 8px;
}

.project-session-file-row .icon-action:hover {
  color: #ffb0b0;
  background: rgba(255, 93, 93, 0.12);
  border-color: rgba(255, 93, 93, 0.34);
}

.proposal-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 9px;
  background: rgba(130, 146, 158, 0.045);
  border: 1px solid rgba(130, 146, 158, 0.12);
  border-radius: 10px;
}

.proposal-summary strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.35;
}

.proposal-file-list {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 0;
  max-height: 272px;
  overflow: auto;
  padding-right: 4px;
}

.proposal-file-list button {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(132, 148, 163, 0.16);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.proposal-file-list button:hover,
.proposal-file-list button:focus-visible {
  background: rgba(255, 138, 0, 0.08);
  outline: none;
}

.draft-file-stats {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 0;
  min-height: 28px;
}

.draft-file-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 26px;
  padding: 3px 8px;
  color: var(--muted);
  background: rgba(130, 146, 158, 0.07);
  border: 1px solid rgba(130, 146, 158, 0.13);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.draft-file-stats strong {
  color: var(--text);
  font-size: 12px;
}

.draft-file-list {
  display: grid;
  align-content: start;
  gap: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding-right: 0;
}

.draft-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 34px;
}

.draft-file-open {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 5px 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid rgba(132, 148, 163, 0.13);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.draft-file-open:hover,
.draft-file-open:focus-visible {
  background: rgba(255, 138, 0, 0.065);
  border-color: rgba(255, 138, 0, 0.3);
  outline: none;
}

.draft-file-open:active {
  transform: translateY(1px);
}

.draft-file-open span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 21px;
  padding: 0 7px;
  color: var(--muted);
  background: rgba(130, 146, 158, 0.09);
  border: 1px solid rgba(130, 146, 158, 0.13);
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.draft-file-open strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.2;
}

.draft-file-open em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.draft-file-delete {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  color: var(--muted);
  background: rgba(130, 146, 158, 0.07);
  border: 1px solid rgba(130, 146, 158, 0.14);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.draft-file-delete::before,
.draft-file-delete::after {
  position: absolute;
  width: 11px;
  height: 2px;
  content: "";
  background: currentColor;
  border-radius: 999px;
}

.draft-file-delete::before {
  transform: rotate(45deg);
}

.draft-file-delete::after {
  transform: rotate(-45deg);
}

.draft-file-row .draft-file-delete:hover,
.draft-file-row .draft-file-delete:focus-visible {
  color: #ffd2d2;
  background: rgba(255, 93, 93, 0.18);
  border-color: rgba(255, 93, 93, 0.46);
  outline: none;
}

.draft-file-delete:active {
  transform: translateY(1px);
}

.draft-file-empty {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 18px;
  color: var(--muted);
  background:
    linear-gradient(180deg, rgba(130, 146, 158, 0.035), rgba(130, 146, 158, 0.018)),
    rgba(255, 255, 255, 0.016);
  border: 1px solid rgba(130, 146, 158, 0.12);
  border-radius: 12px;
  text-align: center;
}

.proposal-question-list {
  display: grid;
  gap: 6px;
  max-height: 104px;
  overflow: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.proposal-question-list strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.proposal-question-list span {
  border-radius: 8px;
  line-height: 1.35;
}

.artifact-row.active {
  color: var(--text);
  background: rgba(255, 138, 0, 0.08);
  border-color: rgba(255, 138, 0, 0.42);
}

.project-artifact-layout {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

#projectRuleScript {
  min-height: 440px;
}

#projectRuleSchema {
  min-height: 260px;
}

.rule-editor-panel {
  display: grid;
  gap: 14px;
}

.rule-editor-panel:has(.scaffold-rule-agent-panel) {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

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

.rule-files-grid textarea {
  min-height: 320px;
}

.agent-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(8, 17, 23, 0.98), rgba(5, 13, 18, 0.98));
  border: 1px solid rgba(255, 138, 0, 0.22);
  border-radius: 16px;
}

.scaffold-rule-agent-panel {
  align-items: start;
}

.agent-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-head .bot-icon {
  color: var(--accent);
}

.agent-head strong {
  display: block;
  color: var(--text);
}

.agent-head small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.agent-panel-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 4px;
  justify-self: start;
  padding: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.agent-panel-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
}

.agent-panel-tabs button.active {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.11);
  border-color: rgba(255, 138, 0, 0.36);
}

.agent-panel-tabs small {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.agent-panel-tabs button.active small {
  color: #090a0c;
  background: var(--accent);
  border-color: var(--accent);
}

.agent-tab-panel {
  display: none;
}

.agent-tab-panel.active {
  display: grid;
  gap: 12px;
}

#aiPrompt {
  min-height: var(--agent-input-min-height);
  font: 15px/1.58 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.agent-rich-input {
  overflow: auto;
  width: 100%;
  min-height: 72px;
  max-height: 260px;
  padding: 12px 13px;
  color: var(--text);
  background: #02070b;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-rich-input:focus {
  border-color: rgba(255, 138, 0, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.08);
}

.agent-rich-input:empty::before {
  content: attr(data-placeholder);
  color: var(--muted-2);
  pointer-events: none;
}

.agent-rich-input.disabled {
  opacity: 0.72;
  cursor: wait;
}

.agent-inline-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: min(420px, 100%);
  height: 1.55em;
  margin: 0 2px;
  padding: 0 3px 0 6px;
  color: var(--text);
  vertical-align: -0.12em;
  background: rgba(255, 138, 0, 0.1);
  border: 1px solid rgba(255, 138, 0, 0.28);
  border-radius: 999px;
  line-height: 1;
  user-select: none;
}

.agent-inline-chip small,
.agent-inline-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-inline-chip small {
  flex: 0 0 auto;
  padding: 1px 5px;
  color: #ffd9ad;
  background: rgba(255, 138, 0, 0.11);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.3;
  text-transform: uppercase;
}

.agent-inline-chip strong {
  max-width: 280px;
  font-size: 12px;
  line-height: 1;
}

.agent-inline-chip .agent-inline-chip-remove {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  min-width: 15px;
  min-height: 0;
  padding: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.agent-inline-chip .agent-inline-chip-remove:hover {
  color: var(--text);
  background: rgba(255, 125, 125, 0.18);
}

.agent-chat-log {
  display: grid;
  gap: var(--agent-chat-gap);
  max-height: 260px;
  overflow: auto;
  padding: var(--agent-chat-padding);
  background: #02070b;
  border: 1px solid var(--line);
  border-radius: var(--agent-chat-radius);
}

.agent-empty {
  color: var(--muted);
}

.agent-message {
  max-width: var(--agent-message-max-width);
  padding: var(--agent-message-padding-y) var(--agent-message-padding-x);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.agent-message.user {
  justify-self: end;
  background: rgba(255, 138, 0, 0.11);
  border-color: rgba(255, 138, 0, 0.24);
}

.agent-message.assistant {
  justify-self: start;
  background: var(--surface);
}

.agent-message.streaming {
  border-color: rgba(255, 138, 0, 0.34);
}

.agent-message.streaming:has(.agent-activity-list) {
  padding-bottom: 8px;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 38px;
  min-height: 20px;
  vertical-align: middle;
}

.typing-dots.compact {
  min-height: 12px;
}

.typing-dots.compact span {
  width: 6px;
  height: 6px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 999px;
  opacity: 0.35;
  animation: typing-dot 1.1s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 140ms;
}

.typing-dots span:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes typing-dot {
  0%, 80%, 100% {
    opacity: 0.32;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.agent-message-role {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.agent-message-body {
  white-space: pre-wrap;
}

.agent-message.assistant .agent-message-body {
  white-space: normal;
}

.agent-message-body .markdown-content {
  display: grid;
  gap: 10px;
  max-width: 100%;
  white-space: normal;
}

.agent-activity-list {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin-top: 5px;
  padding: 6px 8px;
  white-space: normal;
  background: rgba(2, 7, 11, 0.28);
  border: 1px solid rgba(130, 146, 158, 0.18);
  border-radius: 9px;
}

.agent-activity-list.collapsed {
  padding: 0;
  background: transparent;
  border-color: rgba(130, 146, 158, 0.14);
}

.agent-activity-head,
.agent-activity-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.agent-activity-head span,
.agent-activity-toggle span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.agent-activity-head small,
.agent-activity-toggle strong {
  min-width: 0;
  overflow: hidden;
  color: #d5dde4;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-activity-toggle,
.agent-activity-collapse,
.agent-activity-more {
  width: 100%;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.agent-activity-toggle {
  padding: 6px 8px;
}

.agent-activity-toggle:hover,
.agent-activity-collapse:hover,
.agent-activity-more:hover {
  color: var(--text);
}

.agent-activity-collapse,
.agent-activity-more {
  width: auto;
  justify-self: end;
  padding: 2px 0;
  font-size: 11px;
  font-weight: 800;
}

.agent-activity-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  min-width: 0;
  color: #d8e0e7;
  font-size: 11px;
  line-height: 1.25;
}

.agent-activity-dot {
  width: 7px;
  height: 7px;
  margin-top: 4px;
  background: rgba(130, 146, 158, 0.72);
  border-radius: 999px;
}

.agent-activity-row.running .agent-activity-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 138, 0, 0.1);
  animation: agent-activity-pulse 1.1s ease-in-out infinite;
}

.agent-activity-row.done .agent-activity-dot {
  background: #4fd58a;
}

.agent-activity-row.error .agent-activity-dot {
  background: #ff6b6b;
}

.agent-activity-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.agent-activity-text strong {
  flex: 0 0 auto;
  color: #edf3f7;
  font-size: 11px;
  line-height: 1.2;
}

.agent-activity-text small {
  flex: 1 1 100%;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-activity-path {
  max-width: min(360px, 100%);
  overflow: hidden;
  padding: 1px 6px;
  color: #ffd59a;
  background: rgba(255, 138, 0, 0.08);
  border: 1px solid rgba(255, 138, 0, 0.16);
  border-radius: 999px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes agent-activity-pulse {
  0%, 100% {
    opacity: 0.55;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.agent-interaction-pending {
  padding: 10px 10px 0;
}

.agent-interaction-card {
  display: grid;
  gap: 12px;
  justify-self: start;
  width: min(560px, 100%);
  max-width: 100%;
  min-width: 0;
  padding: 12px;
  white-space: normal;
  background: rgba(130, 146, 158, 0.055);
  border: 1px solid rgba(130, 146, 158, 0.18);
  border-radius: 12px;
}

.agent-interaction-card.compact {
  width: min(460px, 100%);
  min-width: 0;
  padding: 10px;
  background: rgba(255, 138, 0, 0.07);
  border-color: rgba(255, 138, 0, 0.22);
}

.agent-interaction-card.readonly {
  opacity: 0.86;
}

.agent-interaction-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agent-interaction-head strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.agent-interaction-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.agent-interaction-head > span {
  flex: 0 0 auto;
  padding: 4px 8px;
  color: #ffd59a;
  background: rgba(255, 138, 0, 0.12);
  border: 1px solid rgba(255, 138, 0, 0.24);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.agent-interaction-fields {
  display: grid;
  align-items: start;
  gap: 10px;
}

.agent-interaction-question {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
}

.agent-interaction-question[data-question-kind="boolean"] {
  justify-self: start;
  width: fit-content;
  max-width: 100%;
}

.agent-interaction-question > span {
  color: #aeb9c2;
  font-size: 12px;
  font-weight: 800;
}

.agent-interaction-question input[type="text"],
.agent-interaction-question input[type="number"],
.agent-interaction-question select,
.agent-interaction-question textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(130, 146, 158, 0.22);
  border-radius: 8px;
  outline: 0;
  color-scheme: dark;
}

.agent-interaction-question textarea {
  min-height: 76px;
  resize: vertical;
}

.agent-interaction-question input:focus,
.agent-interaction-question select:focus,
.agent-interaction-question textarea:focus {
  border-color: rgba(255, 138, 0, 0.44);
  box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.08);
}

.agent-interaction-question small {
  color: #7f8d97;
  font-size: 11px;
}

.agent-interaction-choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.agent-interaction-choice-list label,
.agent-interaction-boolean {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(130, 146, 158, 0.18);
  border-radius: 8px;
}

.agent-interaction-boolean {
  width: fit-content;
  max-width: 100%;
  padding-right: 12px;
}

.agent-interaction-actions {
  display: flex;
  justify-content: flex-end;
}

.agent-interaction-answer-list {
  display: grid;
  gap: 7px;
}

.agent-interaction-answer-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid rgba(130, 146, 158, 0.12);
}

.agent-interaction-answer-list span {
  color: var(--muted);
  font-size: 12px;
}

.agent-interaction-answer-list strong {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content hr,
.markdown-content pre,
.markdown-content table {
  margin: 0;
}

.markdown-divider {
  width: 100%;
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, transparent, rgba(130, 146, 158, 0.34), transparent);
}

.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 2px 0 0;
  color: var(--text);
  line-height: 1.3;
}

.markdown-content h3 {
  font-size: 16px;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-size: 14px;
}

.markdown-content p {
  line-height: 1.62;
}

.markdown-content ul,
.markdown-content ol {
  display: grid;
  gap: 6px;
  padding-left: 20px;
  line-height: 1.55;
}

.markdown-content blockquote {
  padding: 8px 11px;
  color: var(--muted);
  background: rgba(130, 146, 158, 0.08);
  border-left: 3px solid rgba(255, 145, 0, 0.58);
  border-radius: 8px;
}

.markdown-details {
  overflow: hidden;
  max-width: 100%;
  border: 1px solid rgba(130, 146, 158, 0.2);
  border-radius: 10px;
  background: rgba(4, 14, 19, 0.66);
}

.markdown-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 12px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid rgba(130, 146, 158, 0.14);
}

.markdown-details summary::-webkit-details-marker {
  display: none;
}

.markdown-details summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.markdown-details[open] summary::before {
  transform: rotate(45deg);
}

.markdown-details-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.markdown-content code {
  padding: 2px 5px;
  color: #d6e7f7;
  background: rgba(130, 146, 158, 0.13);
  border: 1px solid rgba(130, 146, 158, 0.18);
  border-radius: 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

.markdown-code {
  position: relative;
  overflow: auto;
  max-width: 100%;
  min-height: 0;
  padding: 14px;
  color: #d6e7f7;
  background: #02070b;
  border: 1px solid rgba(130, 146, 158, 0.22);
  border-radius: 10px;
  line-height: 1.5;
}

.markdown-code span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-2);
  font-size: 11px;
  text-transform: uppercase;
}

.markdown-code code {
  display: block;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  white-space: pre;
}

.markdown-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid rgba(130, 146, 158, 0.2);
  border-radius: 10px;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.markdown-content th,
.markdown-content td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(130, 146, 158, 0.14);
  text-align: left;
  vertical-align: top;
}

.markdown-content th {
  color: var(--text);
  background: rgba(130, 146, 158, 0.08);
}

.markdown-content a {
  color: #7fc1ff;
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.agent-message-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.agent-message-refs span {
  max-width: 260px;
  overflow: hidden;
  padding: 3px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.agent-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  color: var(--text);
  background: rgba(255, 138, 0, 0.08);
  border: 1px solid rgba(255, 138, 0, 0.28);
  border-radius: 12px;
}

.agent-status strong {
  display: block;
  font-size: 13px;
}

.agent-status small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.agent-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 138, 0, 0.24);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: agent-spin 900ms linear infinite;
}

@keyframes agent-spin {
  to {
    transform: rotate(360deg);
  }
}

.agent-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 12px;
  align-items: stretch;
}

.scaffold-rule-agent-panel .agent-compose {
  position: sticky;
  bottom: 0;
  z-index: 8;
  align-items: end;
  padding-top: 8px;
  background: linear-gradient(180deg, rgba(5, 13, 18, 0), rgba(5, 13, 18, 0.98) 26%);
}

.agent-input-shell {
  position: relative;
  min-width: 0;
}

.agent-compose > button {
  min-height: 72px;
  color: #090a0c;
  background: var(--accent);
  border-radius: 12px;
  font-weight: 800;
}

.scaffold-rule-agent-panel .agent-compose > button {
  height: 42px;
  min-height: 42px;
  align-self: end;
  border-radius: 10px;
  font-size: 14px;
}

.agent-mention-menu {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(100% + 8px);
  z-index: 20;
  overflow: auto;
  max-height: 260px;
  padding: 8px;
  background: #071016;
  border: 1px solid rgba(255, 138, 0, 0.34);
  border-radius: 12px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
}

.agent-mention-menu button {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
}

.agent-mention-menu button:hover,
.agent-mention-menu button.active {
  color: var(--text);
  background: rgba(255, 138, 0, 0.09);
  border-color: rgba(255, 138, 0, 0.28);
}

.agent-mention-menu strong,
.agent-mention-menu small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-mention-menu strong {
  color: inherit;
  font-size: 13px;
}

.agent-mention-menu small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.mention-kind {
  justify-self: start;
  padding: 3px 8px;
  color: #ffd9ad;
  background: rgba(255, 138, 0, 0.08);
  border: 1px solid rgba(255, 138, 0, 0.2);
  border-radius: 999px;
  font-size: 11px;
}

.agent-mention-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.agent-output-browser {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.generated-file-list {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.018);
  border-right: 1px solid var(--line);
}

.generated-file-list > button {
  display: grid;
  justify-items: start;
  gap: 3px;
  min-height: 44px;
  padding: 7px 10px;
  color: var(--muted);
  background: transparent;
  border-radius: 9px;
  text-align: left;
}

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

.generated-file-list > button span {
  color: inherit;
  font-weight: 760;
}

.generated-file-list > button small {
  color: var(--muted-2);
  font-size: 11px;
}

.generated-file-list > button.active {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.12);
}

.agent-file-tree {
  --agent-tree-indent-step: 22px;
  --agent-tree-row-pad-x: 8px;
  display: grid;
  align-content: start;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: auto;
}

.generated-file-list.agent-file-tree {
  padding-left: 0;
  padding-right: 0;
}

.agent-file-tree-filter {
  position: relative;
  display: grid;
  align-items: center;
  justify-self: center;
  width: min(100%, 280px);
  margin: 0 auto 7px;
}

.agent-file-tree-filter span {
  position: absolute;
  left: 9px;
  width: 12px;
  height: 12px;
  pointer-events: none;
  color: var(--muted-2);
}

.agent-file-tree-filter span::before {
  position: absolute;
  left: 1px;
  top: 1px;
  width: 7px;
  height: 7px;
  content: "";
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.agent-file-tree-filter span::after {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 5px;
  height: 1.5px;
  content: "";
  background: currentColor;
  border-radius: 999px;
  transform: rotate(45deg);
  transform-origin: center;
}

.agent-file-tree-filter input {
  width: 100%;
  min-width: 0;
  height: 26px;
  min-height: 26px;
  padding: 4px 9px 4px 27px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(132, 148, 163, 0.18);
  border-radius: 7px;
  font-size: 12px;
  outline: none;
}

.agent-file-tree-filter input::placeholder {
  color: var(--muted-2);
}

.agent-file-tree-filter input:focus {
  border-color: rgba(255, 138, 0, 0.42);
  box-shadow: 0 0 0 2px rgba(255, 138, 0, 0.1);
}

.agent-file-tree-body {
  min-height: 0;
  overflow: auto;
}

.agent-file-tree-root,
.agent-file-tree-empty {
  min-height: 100%;
}

.agent-file-tree-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.agent-file-tree-node {
  display: grid;
  min-width: 0;
}

.agent-file-tree-children {
  position: relative;
  display: grid;
  min-width: 0;
}

.agent-file-tree-children::before {
  position: absolute;
  left: calc(var(--agent-tree-row-pad-x) + (var(--tree-depth, 0) * var(--agent-tree-indent-step)) + 7px);
  top: 2px;
  bottom: 4px;
  width: 1px;
  content: "";
  pointer-events: none;
  background: rgba(132, 148, 163, 0.22);
}

.agent-file-tree-empty-dir {
  min-height: 28px;
  padding: 6px 8px 6px calc(var(--agent-tree-row-pad-x) + (var(--tree-depth, 0) * var(--agent-tree-indent-step)) + 44px);
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.35;
}

.agent-file-tree-row {
  position: relative;
  --agent-tree-row-state-bg: transparent;
  --agent-tree-row-state-border: transparent;
  display: grid;
  grid-template-columns: 14px 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px 5px calc(var(--agent-tree-row-pad-x) + (var(--tree-depth, 0) * var(--agent-tree-indent-step)));
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  text-align: left;
  cursor: pointer;
  transition: color 140ms ease, transform 140ms ease;
}

.agent-file-tree-row::before {
  position: absolute;
  z-index: 0;
  left: calc(var(--agent-tree-row-pad-x) + (var(--tree-depth, 0) * var(--agent-tree-indent-step)) - 4px);
  right: 4px;
  top: 0;
  bottom: 0;
  content: "";
  pointer-events: none;
  background: var(--agent-tree-row-state-bg);
  border: 1px solid var(--agent-tree-row-state-border);
  border-radius: 8px;
  transition: background 140ms ease, border-color 140ms ease;
}

.agent-file-tree-row > span,
.agent-file-tree-row > strong,
.agent-file-tree-row > em {
  position: relative;
  z-index: 1;
}

.agent-file-tree-row:hover,
.agent-file-tree-row:focus-visible {
  --agent-tree-row-state-bg: rgba(255, 138, 0, 0.07);
  --agent-tree-row-state-border: rgba(255, 138, 0, 0.24);
  color: var(--text);
  background: transparent;
  border-color: transparent;
  outline: none;
}

.agent-file-tree-row.is-drop-target {
  --agent-tree-row-state-bg: rgba(255, 138, 0, 0.1);
  --agent-tree-row-state-border: rgba(255, 138, 0, 0.38);
  color: var(--accent);
  background: transparent;
  border-color: transparent;
}

.agent-file-tree-root.is-drop-target {
  color: var(--accent);
  background: rgba(255, 138, 0, 0.1);
}

.agent-file-tree-node.active > .agent-file-tree-row {
  --agent-tree-row-state-bg: rgba(255, 138, 0, 0.12);
  --agent-tree-row-state-border: rgba(255, 138, 0, 0.28);
  color: var(--accent);
  background: transparent;
  border-color: transparent;
}

.agent-file-tree-node.is-selected > .agent-file-tree-row {
  --agent-tree-row-state-bg: rgba(132, 148, 163, 0.11);
  --agent-tree-row-state-border: rgba(132, 148, 163, 0.28);
  color: var(--text);
}

.agent-file-tree-node.is-selected.active > .agent-file-tree-row {
  --agent-tree-row-state-bg: rgba(255, 138, 0, 0.14);
  --agent-tree-row-state-border: rgba(255, 138, 0, 0.34);
  color: var(--accent);
}

.agent-file-tree-node.is-readonly > .agent-file-tree-row {
  color: var(--muted);
}

.agent-file-tree-row strong,
.agent-file-tree-row em {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-file-tree-row strong {
  color: inherit;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
}

.agent-file-tree-row em {
  color: var(--muted-2);
  font-size: 10.5px;
  font-style: normal;
  line-height: 1.1;
}

.agent-file-tree-caret {
  position: relative;
  width: 12px;
  height: 12px;
  color: var(--muted-2);
}

.agent-file-tree-node.is-dir > .agent-file-tree-row .agent-file-tree-caret::before {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 6px;
  height: 6px;
  content: "";
  border-right: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 140ms ease;
}

.agent-file-tree-node.is-dir.is-expanded > .agent-file-tree-row .agent-file-tree-caret::before {
  transform: translateY(-1px) rotate(45deg);
}

.agent-file-tree-node.is-fixed-root > .agent-file-tree-row {
  cursor: default;
}

.agent-file-tree-node.is-fixed-root > .agent-file-tree-row:hover,
.agent-file-tree-node.is-fixed-root > .agent-file-tree-row:focus-visible {
  --agent-tree-row-state-bg: transparent;
  --agent-tree-row-state-border: transparent;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.agent-file-tree-node.is-fixed-root > .agent-file-tree-row .agent-file-tree-caret::before {
  display: none;
}

.agent-file-tree-icon {
  position: relative;
  width: 17px;
  height: 17px;
  color: currentColor;
}

.agent-file-tree-icon.folder-icon::before {
  position: absolute;
  left: 1px;
  top: 4px;
  width: 15px;
  height: 10px;
  content: "";
  border: 1.6px solid currentColor;
  border-radius: 3px;
}

.agent-file-tree-icon.folder-icon::after {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 7px;
  height: 4px;
  content: "";
  background: currentColor;
  border-radius: 2px 2px 0 0;
  opacity: 0.75;
}

.agent-file-tree-icon:not(.folder-icon)::before {
  position: absolute;
  left: 3px;
  top: 1px;
  width: 11px;
  height: 15px;
  content: "";
  border: 1.6px solid currentColor;
  border-radius: 3px;
}

.agent-file-tree-icon:not(.folder-icon)::after {
  position: absolute;
  right: 3px;
  top: 1px;
  width: 4px;
  height: 4px;
  content: "";
  border-left: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  opacity: 0.75;
}

.agent-file-tree[data-agent-tree="projectDraft"] {
  --agent-tree-row-pad-x: 6px;
  align-content: stretch;
  gap: 0;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-body {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-row {
  grid-template-columns: 14px 16px minmax(0, 1fr) auto;
  gap: 5px;
  min-height: 27px;
  padding: 3px 7px 3px calc(var(--agent-tree-row-pad-x) + (var(--tree-depth, 0) * var(--agent-tree-indent-step)));
  color: var(--text);
  border: 0;
  border-radius: 6px;
  transition: background 120ms ease, color 120ms ease;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-row:hover,
.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-row:focus-visible {
  --agent-tree-row-state-bg: rgba(130, 146, 158, 0.12);
  --agent-tree-row-state-border: transparent;
  color: var(--text);
  background: transparent;
  border-color: transparent;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-node.active > .agent-file-tree-row {
  --agent-tree-row-state-bg: rgba(255, 138, 0, 0.14);
  --agent-tree-row-state-border: transparent;
  color: var(--text);
  background: transparent;
  border-color: transparent;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-row strong {
  font-size: 12px;
  font-weight: 520;
  letter-spacing: 0;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-row em {
  font-size: 10px;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-caret {
  width: 12px;
  height: 12px;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-node.is-empty-dir > .agent-file-tree-row .agent-file-tree-caret::before {
  opacity: 0.45;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon {
  width: 14px;
  height: 14px;
  color: #8aa0b4;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.folder-icon::before {
  left: 1px;
  top: 4px;
  width: 12px;
  height: 8px;
  border-width: 1.4px;
  border-radius: 2px;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.folder-icon::after {
  left: 2px;
  top: 2px;
  width: 6px;
  height: 4px;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-md,
.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-txt {
  color: #40d277;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-json,
.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-yaml,
.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-yml {
  color: #ffa443;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-png,
.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-jpg,
.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-jpeg {
  color: #f05c93;
}

.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-ls,
.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-tp,
.agent-file-tree[data-agent-tree="projectDraft"] .agent-file-tree-icon.is-kl {
  color: var(--accent);
}

.agent-file-context-menu {
  position: fixed;
  z-index: 1000;
  display: grid;
  min-width: 132px;
  padding: 6px;
  background: rgba(7, 15, 20, 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38);
}

.agent-file-context-menu button {
  justify-content: flex-start;
  min-height: 30px;
  padding: 0 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 7px;
  box-shadow: none;
  font-size: 12px;
  text-align: left;
}

.agent-file-context-menu button:hover:not(:disabled),
.agent-file-context-menu button:focus-visible {
  background: rgba(255, 138, 0, 0.12);
  outline: none;
}

.agent-file-context-menu button.danger {
  color: #ff9b9b;
}

.agent-file-context-menu button:disabled {
  color: var(--muted-2);
  cursor: not-allowed;
  opacity: 0.45;
}

.rule-file-editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.rule-file-editor-actions span {
  overflow: hidden;
  max-width: min(280px, 28vw);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-file-editor-actions span.is-error {
  color: #ff9b9b;
}

#agentGeneratedViewer {
  min-height: 260px;
  border: 0;
  border-radius: 0;
  background: var(--editor-bg);
  resize: none;
}

.rule-agent-editor-panel {
  display: grid;
  gap: 14px;
}

.scaffold-rule-agent-panel {
  grid-template-columns: minmax(0, 1fr) clamp(360px, 28vw, 480px);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.scaffold-rule-agent-panel .project-session-chat {
  grid-column: 1;
  grid-row: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.scaffold-rule-agent-panel .project-session-preview {
  grid-column: 2;
  grid-row: 1;
  grid-template-rows: auto minmax(0, 1fr);
  position: relative;
  top: auto;
  align-self: stretch;
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

.template-agent-workbench.project-agent-create-panel {
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.template-agent-workbench .template-agent-session-chat.project-session-chat,
.template-agent-workbench .template-agent-session-preview.project-session-preview {
  grid-row: 1;
}

.template-agent-workbench .template-agent-session-preview.project-session-preview {
  grid-template-rows: minmax(0, 1fr);
}

.agent-file-tree-header {
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.2;
  margin: 0 0 6px;
  padding-left: 8px;
  text-transform: none;
}

.scaffold-rule-session-chat {
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.scaffold-rule-session-chat .agent-chat-log,
.template-agent-session-chat .agent-chat-log {
  max-height: none;
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding: 0 6px 0 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 139, 153, 0.46) transparent;
  scrollbar-gutter: stable;
}

.scaffold-rule-session-chat .agent-chat-log::-webkit-scrollbar,
.template-agent-session-chat .agent-chat-log::-webkit-scrollbar {
  width: 6px;
}

.scaffold-rule-session-chat .agent-chat-log::-webkit-scrollbar-track,
.template-agent-session-chat .agent-chat-log::-webkit-scrollbar-track {
  background: transparent;
}

.scaffold-rule-session-chat .agent-chat-log::-webkit-scrollbar-thumb,
.template-agent-session-chat .agent-chat-log::-webkit-scrollbar-thumb {
  background: rgba(122, 139, 153, 0.38);
  border-radius: 999px;
}

.scaffold-rule-session-chat .agent-chat-log::-webkit-scrollbar-thumb:hover,
.template-agent-session-chat .agent-chat-log::-webkit-scrollbar-thumb:hover {
  background: rgba(154, 171, 186, 0.62);
}

.agent-chat-jump-bottom {
  position: absolute;
  left: 50%;
  bottom: calc(var(--agent-composer-min-height) + 28px);
  transform: translateX(-50%);
  z-index: 11;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  color: var(--text);
  background: rgba(12, 22, 29, 0.18);
  border: 1px solid rgba(154, 171, 186, 0.34);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.agent-chat-jump-bottom:hover {
  color: #ffffff;
  background: rgba(12, 22, 29, 0.34);
  border-color: rgba(186, 200, 212, 0.58);
}

.agent-chat-jump-bottom:focus-visible {
  outline: 2px solid rgba(255, 138, 0, 0.7);
  outline-offset: 3px;
}

.agent-chat-jump-bottom::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%) rotate(45deg);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.scaffold-rule-composer {
  position: relative;
  bottom: auto;
  z-index: 12;
  padding-top: 12px;
  background:
    linear-gradient(180deg, rgba(3, 8, 12, 0), var(--bg) 34%),
    var(--bg);
}

.scaffold-rule-composer-shell {
  min-height: var(--agent-composer-min-height);
  overflow: visible;
  position: relative;
  z-index: 12;
}

.scaffold-rule-composer-shell .agent-input-shell {
  min-height: var(--agent-input-min-height);
}

.scaffold-rule-composer-shell .agent-rich-input {
  min-height: var(--agent-input-min-height);
  max-height: none;
  height: 100%;
  padding: var(--agent-input-padding);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 15px;
  line-height: 1.58;
}

.scaffold-rule-composer-shell .agent-rich-input:focus {
  box-shadow: none;
}

.scaffold-rule-output-browser,
.template-agent-output-browser {
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(0, 1fr);
}

.scaffold-rule-output-browser .generated-file-list,
.template-agent-output-browser .generated-file-list {
  border-right: 0;
  min-width: 0;
  width: 100%;
}

.scaffold-rule-output-browser .agent-file-tree-body,
.template-agent-output-browser .agent-file-tree-body {
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 139, 153, 0.46) transparent;
  scrollbar-gutter: stable;
}

.scaffold-rule-output-browser .agent-file-tree-body::-webkit-scrollbar,
.template-agent-output-browser .agent-file-tree-body::-webkit-scrollbar {
  width: 6px;
}

.scaffold-rule-output-browser .agent-file-tree-body::-webkit-scrollbar-track,
.template-agent-output-browser .agent-file-tree-body::-webkit-scrollbar-track {
  background: transparent;
}

.scaffold-rule-output-browser .agent-file-tree-body::-webkit-scrollbar-thumb,
.template-agent-output-browser .agent-file-tree-body::-webkit-scrollbar-thumb {
  background: rgba(122, 139, 153, 0.38);
  border-radius: 999px;
}

.scaffold-rule-output-browser .agent-file-tree-body::-webkit-scrollbar-thumb:hover,
.template-agent-output-browser .agent-file-tree-body::-webkit-scrollbar-thumb:hover {
  background: rgba(154, 171, 186, 0.62);
}

.scaffold-rule-output-browser.is-empty {
  grid-template-columns: 1fr;
}

.scaffold-rule-output-browser.is-empty .generated-file-list {
  display: none;
}

.rule-file-editor-dialog #agentGeneratedViewer {
  min-height: 0;
}

.no-pad {
  padding: 0;
}

.rule-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 18px;
}

.rule-editor-grid textarea {
  min-height: 300px;
}

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

.calendar-mini {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 7px;
  vertical-align: -2px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}

.calendar-mini::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 4px;
  height: 1.5px;
  background: currentColor;
}

.code-empty {
  display: grid;
  place-items: center;
  min-height: 620px;
  color: var(--muted);
  background: #02070b;
  border-left: 1px solid var(--line);
}

.view.active[data-view="files"],
html[data-initial-view="files"] .view[data-view="files"] {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  gap: 14px;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  color: var(--text);
}

.view.active[data-view="emulator"],
html[data-initial-view="emulator"] .view[data-view="emulator"] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  min-height: calc(100vh - 28px);
  color: var(--text);
}

.view.active[data-view="settings"],
html[data-initial-view="settings"] .view[data-view="settings"] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  color: var(--text);
}

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

.library-page-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

.emulator-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.emulator-experimental-state {
  align-self: stretch;
  display: grid;
  align-content: center;
  justify-items: start;
  width: min(760px, 100%);
  min-height: 360px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 44px);
  background: linear-gradient(145deg, rgba(11, 24, 32, 0.96), rgba(5, 13, 18, 0.98));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.emulator-experimental-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.emulator-experimental-state > h2 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.15;
}

.emulator-experimental-state > p:not(.emulator-experimental-kicker) {
  max-width: 650px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.emulator-capability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 28px;
}

.emulator-capability-grid article {
  min-width: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.emulator-capability-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.emulator-capability-grid strong {
  display: block;
  color: var(--text);
  font-size: 16px;
}

.emulator-capability-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.library-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: min(620px, 100%);
}

.library-page-search {
  position: relative;
  display: block;
  flex: 1 1 300px;
  min-width: 260px;
  max-width: 520px;
}

.library-page-search span {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 1.6px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-54%);
}

.library-page-search span::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 1.6px;
  background: var(--muted);
  border-radius: 999px;
  transform: rotate(45deg);
}

.library-page-search input {
  width: 100%;
  height: 38px;
  padding: 0 16px 0 40px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  outline: none;
  box-shadow: none;
}

.library-page-search input:focus {
  border-color: rgba(255, 138, 0, 0.46);
}

.library-page-search input::placeholder {
  color: var(--muted);
}

.library-upload-button {
  flex: 0 0 auto;
  height: 38px;
  min-width: 72px;
  padding: 0 18px;
  color: #110900;
  background: var(--accent);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.library-page-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.library-filter-tabs,
.library-source-tabs,
.library-view-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.library-filter-tabs button,
.library-source-tabs button {
  min-height: 32px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.library-filter-tabs button.active,
.library-source-tabs button.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(255, 138, 0, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 138, 0, 0.08);
}

.library-source-tabs {
  flex-wrap: nowrap;
  justify-content: center;
}

.library-view-tools {
  justify-content: flex-end;
}

.library-view-tools select {
  height: 34px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 10px;
  font-size: 13px;
  color-scheme: dark;
}

.library-view-tools select option {
  color: var(--text);
  background-color: #071017;
}

.library-view-tools select option:checked,
.library-view-tools select option:hover {
  color: #ffffff;
  background-color: #2a1a08;
  box-shadow: 0 0 0 999px rgba(255, 138, 0, 0.22) inset;
}

.library-sort-control {
  position: relative;
  flex: 0 0 auto;
}

.library-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 138px;
  height: 36px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.library-sort-button:hover,
.library-sort-button[aria-expanded="true"] {
  color: #ffffff;
  background: rgba(255, 138, 0, 0.08);
  border-color: rgba(255, 138, 0, 0.42);
}

.library-sort-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.library-sort-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: grid;
  gap: 2px;
  min-width: 170px;
  padding: 6px;
  background: #071017;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42);
}

.library-sort-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.library-sort-menu button:hover,
.library-sort-menu button.active,
.library-sort-menu button[aria-selected="true"] {
  color: #ffffff;
  background: rgba(255, 138, 0, 0.16);
}

.library-icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
}

.library-icon-button.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-strong);
}

.library-list-icon,
.library-grid-icon {
  position: relative;
  display: block;
  width: 15px;
  height: 15px;
}

.library-list-icon::before,
.library-list-icon::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: currentColor;
}

.library-list-icon::before {
  left: 0;
  top: 1px;
  width: 2px;
  height: 2px;
  box-shadow: 0 6px 0 currentColor, 0 12px 0 currentColor;
}

.library-list-icon::after {
  left: 5px;
  right: 0;
  top: 1px;
  height: 2px;
  box-shadow: 0 6px 0 currentColor, 0 12px 0 currentColor;
}

.library-grid-icon::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 2px solid currentColor;
  border-radius: 2px;
  box-shadow: 11px 0 0 -2px currentColor, 0 11px 0 -2px currentColor, 11px 11px 0 -2px currentColor;
}

.file-library-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 156px) minmax(80px, 116px) 146px;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.file-library-table-head button {
  justify-self: start;
  color: var(--muted);
  background: transparent;
}

.file-library-list {
  display: grid;
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.file-library-list.list-view {
  gap: 0;
}

.library-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 156px) minmax(80px, 116px) 146px;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.library-file-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 9px 0;
  color: inherit;
  text-align: left;
  background: transparent;
}

.library-thumb {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.library-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-file-glyph {
  position: relative;
  width: 16px;
  height: 20px;
  color: var(--muted);
  border: 1.8px solid currentColor;
  border-radius: 4px;
}

.library-file-glyph::before {
  content: "";
  position: absolute;
  right: -2px;
  top: -2px;
  width: 7px;
  height: 7px;
  background: var(--surface-2);
  border-left: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
}

.library-file-glyph.text,
.library-file-glyph.json,
.library-file-glyph.table {
  color: #8fa0af;
}

.library-file-glyph.archive {
  color: var(--accent);
}

.library-file-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.library-file-copy strong,
.library-file-copy small,
.library-file-copy em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-file-copy strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.library-file-copy small {
  color: #94a2ae;
  font-size: 12px;
}

.library-file-copy em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.library-modified,
.library-size {
  color: #ccd6df;
  font-size: 14px;
}

.library-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.library-row-actions .ghost-action,
.library-row-actions .button-link {
  min-height: 30px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 13px;
}

.file-library-list.grid-view {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.file-library-list.grid-view .library-file-row {
  grid-template-columns: 1fr;
  align-items: stretch;
  min-height: 190px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.file-library-list.grid-view .library-file-main {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
  padding: 0;
}

.file-library-list.grid-view .library-thumb {
  width: 100%;
  height: 84px;
}

.file-library-list.grid-view .library-modified,
.file-library-list.grid-view .library-size {
  font-size: 13px;
}

.file-library-list.grid-view .library-row-actions {
  justify-content: stretch;
}

.file-library-list.grid-view .library-row-actions > * {
  flex: 1 1 0;
}

.library-empty,
.library-status {
  color: var(--muted);
}

.library-empty {
  padding: 42px 0;
  text-align: center;
}

.library-status {
  min-height: 22px;
}

#resourceLibraryStatus {
  width: 100%;
  text-align: center;
}

.file-preview-dialog:has(#filePreviewAsset:not(.hidden)) {
  grid-template-rows: auto minmax(0, 1fr);
}

.file-preview-asset {
  display: grid;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  background: #040a0f;
}

.file-preview-asset img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
  border-radius: 8px;
}

.resource-upload-dialog {
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(820px, 100%);
  height: min(760px, calc(100vh - 48px));
}

.resource-upload-body {
  display: grid;
  align-content: start;
  gap: 18px;
  min-height: 0;
  padding: 22px;
  overflow: auto;
}

.resource-upload-body label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.resource-upload-body input,
.resource-upload-body select {
  width: 100%;
  min-height: 42px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  text-transform: none;
}

.resource-upload-panel {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.resource-upload-panel.active {
  display: grid;
}

.resource-upload-panel label:first-child,
.resource-upload-panel label:last-child {
  grid-column: 1 / -1;
}

.resource-upload-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-top: 1px solid var(--line-strong);
}

.resource-upload-footer span {
  color: var(--muted);
}

@media (max-width: 1280px) {
  .resource-card-grid,
  .scaffold-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  .shell {
    --sidebar-width: 62px;
  }

  .brand {
    justify-content: center;
    padding: 18px 5px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand-mark img,
  .brand-mark svg {
    width: 23px;
    height: 23px;
  }

  .brand > div:last-child,
  .nav-item span:last-child,
  .profile > div:last-child {
    display: none;
  }

  .sidebar-toggle {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-experimental-badge {
    margin-left: 2px;
  }

  .nav-item::before,
  .nav-item::after {
    position: absolute;
    left: calc(100% + 10px);
    z-index: 40;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-50%) translateX(-4px);
    transition: opacity 140ms ease, transform 140ms ease;
  }

  .nav-item::before {
    content: "";
    top: 50%;
    width: 8px;
    height: 8px;
    background: var(--surface-3);
    border-left: 1px solid var(--line-strong);
    border-bottom: 1px solid var(--line-strong);
    transform: translateY(-50%) translateX(-4px) rotate(45deg);
  }

  .nav-item::after {
    content: attr(aria-label);
    top: 50%;
    width: max-content;
    max-width: 180px;
    padding: 7px 10px;
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
  }

  .nav-item:hover::before,
  .nav-item:hover::after,
  .nav-item:focus-visible::before,
  .nav-item:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }

  .nav-item:hover::before,
  .nav-item:focus-visible::before {
    transform: translateY(-50%) translateX(0) rotate(45deg);
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }

  .project-agent-create-panel {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

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

  .settings-form {
    grid-template-columns: 1fr;
  }

  .provider-first-settings {
    grid-template-columns: 1fr;
  }

  .provider-models-layout,
  .agent-interaction-settings-grid {
    grid-template-columns: 1fr;
  }

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

  .skill-startup-bar {
    grid-template-columns: 1fr;
  }

  .settings-profiles-panel {
    grid-column: auto;
  }
}

@media (max-width: 820px) {
  .shell,
  .shell.sidebar-collapsed {
    display: block;
    min-height: 100vh;
  }

  .main:has(.view.active .card-list-pane:not(.hidden)),
  html[data-initial-view="templates"] .main,
  html[data-initial-view="scaffolds"] .main,
  html[data-initial-view="projects"] .main,
  .main:has(.view.active #templateDetailPane:not(.hidden)),
  .main:has(.view.active[data-view="files"]),
  html[data-initial-view="files"] .main {
    height: calc(100dvh - 68px);
    min-height: calc(100dvh - 68px);
  }

  .main:has(.view.active #projectCreatePane:not(.hidden)) {
    height: auto;
    min-height: calc(100dvh - 68px);
    overflow: visible;
  }

  html:has(.view.active #projectCreatePane:not(.hidden)),
  body:has(.view.active #projectCreatePane:not(.hidden)) {
    overflow: auto;
  }

  html[data-initial-view="dashboard"] .main,
  .main.dashboard-home {
    height: calc(100dvh - 68px);
    min-height: calc(100dvh - 68px);
    overflow: hidden;
  }

  .main:has(.view.active #projectCreatePane:not(.hidden)) .view.active,
  .view.active:has(#projectCreatePane:not(.hidden)) {
    min-height: auto;
    overflow: visible;
  }

  .main:has(.view.active #templateDetailPane:not(.hidden)) .view.active,
  .view.active:has(#templateDetailPane:not(.hidden)) {
    padding: 10px 14px 8px;
  }

  .template-detail-pane {
    gap: 10px;
  }

  .template-robot-form {
    grid-template-columns: 1fr;
  }

  .template-robot-metadata-fields {
    grid-template-columns: 1fr;
  }

  .template-robot-wide,
  .template-robot-form-actions {
    grid-column: 1;
  }

  .template-robot-form-actions {
    display: grid;
    grid-template-columns: minmax(82px, 0.9fr) minmax(142px, 1.35fr);
    justify-content: center;
    justify-items: center;
    gap: 10px;
    padding: 14px 24px 18px;
  }

  .template-robot-form-actions button {
    width: 100%;
    min-width: 0;
  }

  .template-robot-popover {
    right: auto;
    width: min(320px, calc(100vw - 24px));
  }

  .template-detail-header {
    min-height: 58px;
  }

  .template-detail-header .title-group {
    display: none;
  }

  .template-detail-header .template-detail-actions {
    width: 100%;
    padding-top: 0;
  }

  .template-file-toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .template-current-path,
  #templateCurrentPath {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .template-path-crumb {
    max-width: 62vw;
  }

  .template-file-actions {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .template-file-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(560px, auto);
    gap: 10px;
  }

  html:has(.view.active #templateDetailPane:not(.hidden)),
  body:has(.view.active #templateDetailPane:not(.hidden)) {
    overflow: auto;
  }

  .main:has(.view.active #templateDetailPane:not(.hidden)) {
    display: block;
    height: auto;
    min-height: calc(100dvh - 68px);
    overflow: visible;
  }

  .main:has(.view.active #templateDetailPane:not(.hidden)) .view.active,
  .view.active:has(#templateDetailPane:not(.hidden)),
  .template-detail-pane,
  .template-file-workbench,
  .template-file-layout {
    height: auto;
    overflow: visible;
  }

  .template-file-browser {
    min-height: 210px;
    max-height: 210px;
  }

  .template-file-editor-panel {
    min-height: 560px;
  }

  .template-editor-host,
  #templateEditorHost {
    min-height: 470px;
  }

  .template-file-row {
    grid-template-columns: minmax(0, 1fr);
    min-height: 56px;
  }

  .template-file-meta {
    gap: 6px;
    font-size: 11px;
  }

  .template-file-browser.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .template-file-browser.grid-view .template-file-row {
    min-height: 118px;
  }

  .view.active:has(#projectCreatePane:not(.hidden)) .project-create-pane {
    height: auto;
    min-height: 0;
  }

  .view.active:has(#projectCreatePane:not(.hidden)) .project-agent-create-panel,
  .view.active:has(#projectCreatePane:not(.hidden)) .project-session-layout,
  .view.active:has(#projectCreatePane:not(.hidden)) .project-session-chat,
  .view.active:has(#projectCreatePane:not(.hidden)) .project-session-preview {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .view.active:has(#projectCreatePane:not(.hidden)) .project-agent-create-panel {
    padding-bottom: 16px;
  }

  .view.active:has(#projectCreatePane:not(.hidden)) .project-session-messages {
    max-height: none;
    overflow: visible;
    padding-left: var(--agent-chat-mobile-padding-x);
    padding-right: var(--agent-chat-mobile-padding-x);
  }

  .scaffold-rule-session-chat .agent-chat-log {
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .view.active:has(#projectCreatePane:not(.hidden)) .project-session-messages .agent-message,
  .scaffold-rule-session-chat .agent-message {
    max-width: var(--agent-message-mobile-max-width);
    padding-left: var(--agent-message-mobile-padding-x);
    padding-right: var(--agent-message-mobile-padding-x);
  }

  .sidebar {
    position: static;
    top: auto;
    z-index: 20;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
    background: rgba(1, 6, 9, 0.96);
    backdrop-filter: blur(14px);
  }

  .brand,
  .shell.sidebar-collapsed .brand {
    display: none;
    justify-content: flex-start;
    min-height: 62px;
    padding: 10px 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand-mark img,
  .brand-mark svg {
    width: 23px;
    height: 23px;
  }

  .settings-field-grid,
  .settings-status {
    grid-template-columns: 1fr;
  }

  .settings-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-section-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-provider-toolbar,
  .agent-interaction-settings-grid,
  .provider-access-grid {
    grid-template-columns: 1fr;
  }

  .provider-access-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .provider-access-status {
    max-width: 100%;
    width: fit-content;
  }

  .settings-model-row {
    grid-template-columns: 1fr;
  }

  .settings-model-meta {
    justify-content: flex-start;
  }

  .settings-default-model-button {
    width: fit-content;
  }

  .settings-mini-badge {
    max-width: 100%;
  }

  .settings-profile-row {
    grid-template-columns: 1fr;
    gap: 4px;
    align-items: flex-start;
  }

  .settings-profile-row.header {
    display: none;
  }

  .settings-editor-head {
    display: none;
  }

  .settings-edit-row,
  .model-profile-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .settings-delete-row {
    width: 100%;
    height: 34px;
  }

  .settings-field-label {
    display: block;
  }

  .skill-settings-row {
    grid-template-columns: 1fr;
  }

  .skill-settings-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand-title {
    font-size: 16px;
    line-height: 1.15;
  }

  .brand-subtitle {
    font-size: 12px;
  }

  .brand > div:nth-child(2),
  .nav-item span:last-child,
  .shell.sidebar-collapsed .brand > div:nth-child(2),
  .shell.sidebar-collapsed .nav-item span:last-child {
    display: block;
  }

  .sidebar-toggle,
  .shell.sidebar-collapsed .sidebar-toggle {
    display: none;
  }

  .profile {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 12px 12px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item,
  .shell.sidebar-collapsed .nav-item {
    flex: 0 0 auto;
    justify-content: flex-start;
    width: auto;
    height: 40px;
    min-width: 0;
    gap: 8px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
    scroll-snap-align: start;
  }

  .nav-item::before,
  .nav-item::after,
  .shell.sidebar-collapsed .nav-item::before,
  .shell.sidebar-collapsed .nav-item::after {
    display: none;
  }

  .nav-icon {
    width: 19px;
    height: 19px;
  }

  .hero-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .view {
    padding: 8px 12px;
  }

  .main:has(.view.active #projectCreatePane:not(.hidden)) .view.active,
  .view.active:has(#projectCreatePane:not(.hidden)) {
    padding-left: 4px;
    padding-right: 4px;
  }

  .view.active:has(#projectCreatePane:not(.hidden)) .project-agent-create-panel {
    margin-left: 4px;
    margin-right: 4px;
  }

  .view.active:has(#projectCreatePane:not(.hidden)) .project-detail-header {
    margin-left: -4px;
    margin-right: -4px;
  }

  .stats-grid, .dashboard-grid, .workspace-grid, .editor-grid, .code-layout, .grid-2, .grid-3,
  .rule-toolbar, .rule-editor-grid, .rule-files-grid, .rule-browser-panel, .settings-form, .agent-reference-list, .agent-compose, .agent-output-browser,
  .scaffold-upload-body, .resource-card-grid, .scaffold-card-grid, .scaffold-detail-layout, .project-create-body, .project-detail-layout,
  .project-overview-grid, .project-agent-create-panel, .project-agent-context-bar, .project-session-layout,
  .project-session-composer {
    grid-template-columns: 1fr;
  }

  .resource-card-actions,
  .template-card-actions {
    grid-template-columns: minmax(110px, 0.85fr) minmax(118px, 1fr) minmax(74px, 0.72fr);
  }

  .rule-workbench-layout {
    grid-template-columns: 1fr;
  }

  .rule-folder-panel {
    position: static;
    grid-row: auto;
  }

  .stats-grid,
  .dashboard-grid,
  .workspace-grid {
    gap: 14px;
    margin-top: 16px;
  }

  .view.active[data-view="dashboard"] {
    display: block;
    height: 100%;
    min-height: 0;
    padding: 12px;
    overflow: auto;
  }

  .view.active[data-view="dashboard"] .dashboard-grid,
  .view.active[data-view="dashboard"] .hero-card {
    margin-top: 14px;
  }

  .stat-card {
    min-height: 118px;
    padding: 18px;
  }

  .hero-card {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px;
  }

  .hero-card .ghost-action {
    width: 100%;
  }

  .card-header {
    display: grid;
    min-height: 0;
    padding: 16px 18px;
  }

  .card-header .button-group {
    justify-content: stretch;
  }

  .card-header .button-group button {
    flex: 1 1 auto;
  }

  .toolbar,
  .form-row {
    display: grid;
    padding: 16px 18px;
  }

  .form-row button {
    flex-basis: auto;
  }

  .field,
  .grid-2,
  .grid-3 {
    padding-left: 18px;
    padding-right: 18px;
  }

  .scaffold-upload-actions {
    grid-column: auto;
    justify-content: stretch;
  }

  .scaffold-upload-actions button {
    width: 100%;
    min-width: 0;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, max-content));
    justify-content: end;
    width: 100%;
  }

  .project-detail-header {
    margin: -8px -12px 0;
  }

  .project-detail-actions {
    max-width: none;
  }

  .project-agent-context-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    width: 100%;
    padding: 0;
  }

  .project-agent-context-bar .project-scaffold-select {
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }

  .project-agent-context-bar .project-actions-control {
    width: 100%;
    min-width: 0;
  }

  .project-agent-context-bar button {
    width: 100%;
    min-width: 0;
  }

  .project-session-chat {
    grid-column: 1;
    grid-row: auto;
    grid-template-rows: minmax(260px, auto) auto;
  }

  .project-session-messages {
    min-height: 260px;
    max-height: 420px;
  }

  .project-session-preview {
    grid-column: 1;
    grid-row: auto;
    grid-template-rows: auto auto;
  }

  .project-session-preview .draft-file-browser-section,
  .project-session-preview .project-detail-working-section {
    min-height: 260px;
  }

  .project-composer-footer {
    align-items: flex-end;
  }

  .project-composer-tools {
    flex: 1 1 0;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
  }

  .project-model-select {
    flex: 1 1 170px;
    min-width: 0;
  }

  .scaffold-rule-composer .project-model-select {
    flex: 0 1 218px;
    width: min(218px, 100%);
    max-width: 218px;
  }

  .project-interaction-mode-select {
    flex: 0 1 124px;
  }

  .project-composer-context {
    flex: 0 0 126px;
    width: 126px;
    max-width: 126px;
    min-width: 126px;
  }

  .card-pagination {
    align-items: center;
    flex-direction: column;
  }

  .pagination-controls {
    justify-content: center;
    width: auto;
  }

  .scaffold-card {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    grid-template-areas: "mark main side";
    gap: 10px 12px;
    min-height: 0;
    padding: 12px;
    border-radius: 14px;
  }

  .scaffold-card.has-actions {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    grid-template-areas:
      "mark main side"
      ". actions actions";
  }

  .scaffold-card h3 {
    max-width: none;
    font-size: 16px;
  }

  .scaffold-card p {
    font-size: 14px;
  }

  .tag-row {
    flex-wrap: wrap;
  }

  .resource-card-title-line,
  .resource-card-detail-line {
    flex-wrap: wrap;
  }

  .resource-card-side {
    flex-wrap: wrap;
  }

  .scaffold-detail-pane {
    margin: 0;
    overflow: visible;
  }

  .entity-detail-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }

  .entity-detail-header .title-group {
    flex: 0 1 auto;
    width: 100%;
  }

  .entity-detail-header .title-group > div:last-child {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .entity-detail-header h2 {
    max-width: 100%;
    white-space: normal;
  }

  .entity-detail-header p {
    white-space: normal;
  }

  .entity-detail-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .entity-detail-actions select {
    flex: 1 1 150px;
    width: auto;
  }

  .scaffold-detail-actions {
    display: grid;
    grid-template-columns: minmax(58px, auto) minmax(112px, 1fr) 40px;
    gap: 8px;
    width: 100%;
  }

  .scaffold-detail-actions .status-pill,
  .scaffold-detail-actions select,
  .scaffold-detail-actions .scaffold-actions-control,
  .scaffold-detail-actions .ghost-action {
    width: 100%;
    min-width: 0;
  }

  .scaffold-detail-actions select {
    flex: 0 0 auto;
    padding-left: 8px;
    padding-right: 24px;
  }

  .scaffold-detail-actions .ghost-action {
    padding-left: 8px;
    padding-right: 8px;
    font-size: 12px;
  }

  .scaffold-detail-actions .scaffold-action-menu-button {
    width: 100%;
    min-width: 0;
    padding: 0;
  }

  .scaffold-detail-layout {
    min-height: 0;
  }

  .scaffold-detail-pane:has(.scaffold-tab-panel.active[data-scaffold-panel="files"]) {
    height: calc(100vh - 116px);
    min-height: 0;
    overflow: hidden;
  }

  .scaffold-detail-layout:has(.scaffold-tab-panel.active[data-scaffold-panel="files"]) {
    height: calc(100vh - 172px);
    min-height: 0;
    overflow: hidden;
  }

  .scaffold-detail-layout:has(.scaffold-tab-panel.active[data-scaffold-panel="files"]) .scaffold-files-panel {
    height: calc(100vh - 172px);
    min-height: 0;
    overflow: hidden;
  }

  .project-detail-layout {
    min-height: 0;
  }

  .project-detail-layout > .scaffold-files-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .project-detail-layout > .scaffold-detail-sidebar {
    grid-column: 1;
    grid-row: 2;
  }

  .scaffold-detail-sidebar {
    padding: 14px;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
  }

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

  .metadata-list div {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 7px;
  }

  .metadata-list .metadata-description {
    grid-column: 1 / -1;
  }

  .metadata-list div span:nth-child(2) {
    display: none;
  }

  .scaffold-files-panel {
    padding: 14px;
  }

  .scaffold-workbench-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin: 0;
  }

  .files-panel-header {
    align-items: stretch;
    display: grid;
    gap: 10px;
  }

  .files-panel-actions {
    align-items: stretch;
    display: grid;
    gap: 10px;
  }

  .file-pagination-top {
    justify-content: center;
    width: 100%;
  }

  .generated-file-list {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .generated-file-list > button {
    flex: 1 0 auto;
  }

  .rule-workbench-header {
    display: grid;
    padding: 14px;
  }

  .scaffold-file-row {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .scaffold-file-row select,
  .scaffold-file-row input[data-file-group] {
    grid-column: 2;
  }

  #projectConfig {
    width: calc(100% - 36px);
    margin: 0 18px 18px;
  }

  .project-create-body {
    padding: 16px 18px;
  }

  .project-session-layout {
    padding-left: 0;
    padding-right: 0;
  }

  .project-agent-context-bar button {
    width: 100%;
  }

  .project-session-composer .project-send-button {
    width: 38px;
  }

  .project-session-preview {
    grid-column: 1;
    grid-row: auto;
  }

  .markdown-content .markdown-code {
    min-height: 0;
    max-height: 340px;
    margin: 0;
  }

  .code-card,
  #codeViewer,
  .code-empty {
    min-height: 420px;
  }

  #codeViewer {
    border-top: 1px solid var(--line);
  }

  .artifact-list {
    max-height: 240px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  pre {
    min-height: 260px;
    margin: 0 18px 18px;
  }

  .file-preview-modal {
    padding: 12px;
  }

  .file-preview-dialog {
    width: 100%;
    height: calc(100vh - 24px);
    border-radius: 14px;
  }

  .file-preview-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }

  .file-preview-header .ghost-action {
    width: 100%;
  }

  .file-preview-modal.code-preview-mode .file-preview-header {
    align-items: flex-end;
  }

  .file-preview-modal.code-preview-mode .file-preview-header .ghost-action {
    width: auto;
  }

  .scaffold-edit-body {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 18px 24px;
  }

  .scaffold-edit-body label {
    width: min(100%, 420px);
  }

  .scaffold-edit-actions {
    display: grid;
    grid-template-columns: minmax(82px, 0.9fr) minmax(142px, 1.35fr);
    justify-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px 18px;
  }

  .scaffold-edit-actions button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 13px;
  }

  .brand {
    min-height: 58px;
  }

  .brand-title {
    font-size: 15px;
  }

  .brand-subtitle {
    display: none;
  }

  .nav {
    padding: 8px 10px 10px;
  }

  .nav-item {
    height: 38px;
    padding: 0 10px;
  }

  .experimental-badge {
    min-height: 20px;
    padding-inline: 6px;
    font-size: 9px;
  }

  .nav-experimental-badge {
    min-height: 17px;
    padding-inline: 4px;
    font-size: 7px;
  }

  .emulator-experimental-state {
    min-height: 0;
    padding: 22px 18px;
  }

  .emulator-capability-grid {
    grid-template-columns: 1fr;
  }

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

  .scaffold-card {
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-areas:
      "mark main"
      "side side";
    gap: 10px 12px;
  }

  .scaffold-card.has-actions {
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-areas:
      "mark main"
      "side side"
      "actions actions";
  }

  .compact-mark {
    width: 38px;
    height: 38px;
  }

  .scaffold-card h3,
  .scaffold-card p {
    flex-basis: auto;
    max-width: 100%;
  }

  .resource-card-side {
    justify-content: flex-start;
  }

  .resource-card-actions,
  .template-card-actions {
    grid-template-columns: minmax(74px, 0.8fr) minmax(108px, 1fr) minmax(68px, 0.72fr);
    width: 100%;
  }

  .resource-card-actions select,
  .resource-card-actions button,
  .template-card-actions select,
  .template-card-actions button {
    padding-right: 8px;
    padding-left: 8px;
    font-size: 12px;
  }

  .status-pill {
    margin-top: 0;
  }

  .entity-detail-actions .status-pill {
    margin-top: 0;
  }

  .metadata-list {
    grid-template-columns: 1fr;
  }

  .role-filter-list {
    gap: 6px;
  }

  .scaffold-file-row {
    display: block;
    grid-template-columns: minmax(0, 1fr);
    min-height: 138px;
  }

  .file-doc-icon {
    display: none;
  }

  .file-main {
    display: block;
    min-height: 36px;
    margin-bottom: 10px;
  }

  .scaffold-file-row select,
  .scaffold-file-row input[data-file-group] {
    display: block;
    margin-top: 10px;
  }

  .agent-panel {
    padding: 12px;
  }

  .agent-output-browser,
  #agentGeneratedViewer {
    min-height: 220px;
  }

  .rule-editor-grid textarea,
  #ruleScript,
  #ruleSchema {
    min-height: 240px;
  }

  .settings-status,
  .settings-form,
  .pi-base-prompt-card,
  .prompt-template-grid,
  .grid-2,
  .field,
  .toolbar,
  .form-row {
    padding-left: 14px;
    padding-right: 14px;
  }

}

@media (max-width: 820px) {
  html:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]),
  body:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]) {
    overflow: auto;
  }

  .main:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]) {
    display: block;
    height: auto;
    overflow: visible;
  }

  .main:has(.view.active #scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]) .view.active,
  .view.active:has(#scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]) {
    padding-left: 4px;
    padding-right: 4px;
  }

  .view.active:has(#scaffoldDetailPane:not(.hidden) .scaffold-tab-panel.active[data-scaffold-panel="rules"]),
  .scaffold-detail-pane:has(.scaffold-tab-panel.active[data-scaffold-panel="rules"]),
  .scaffold-detail-layout:has(.scaffold-tab-panel.active[data-scaffold-panel="rules"]),
  .scaffold-detail-layout:has(.scaffold-tab-panel.active[data-scaffold-panel="rules"]) .scaffold-files-panel,
  .scaffold-tab-panel.active[data-scaffold-panel="rules"],
  .rule-workbench,
  .rule-workbench-layout.rules-agent-workspace,
  .rule-editor-panel:has(.scaffold-rule-agent-panel) {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .scaffold-rule-agent-panel {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .scaffold-rule-session-chat {
    overflow: visible;
  }

  .scaffold-rule-agent-panel .project-session-chat {
    grid-column: 1;
    grid-row: 1;
    overflow: visible;
  }

  .scaffold-detail-layout:has(.scaffold-tab-panel.active[data-scaffold-panel="rules"]) .scaffold-files-panel {
    padding-left: 4px;
    padding-right: 4px;
  }

  .scaffold-rule-agent-panel .project-session-preview {
    grid-column: 1;
    grid-row: 2;
    grid-template-rows: auto minmax(320px, 1fr);
  }
}

@media (max-width: 820px) {
  html:has(.view.active[data-view="files"]),
  body:has(.view.active[data-view="files"]),
  html:has(.view.active .card-list-pane:not(.hidden)),
  body:has(.view.active .card-list-pane:not(.hidden)),
  html[data-initial-view="files"],
  html[data-initial-view="files"] body,
  html[data-initial-view="templates"],
  html[data-initial-view="templates"] body,
  html[data-initial-view="scaffolds"],
  html[data-initial-view="scaffolds"] body,
  html[data-initial-view="projects"],
  html[data-initial-view="projects"] body {
    overflow: auto;
  }

  .main:has(.view.active .card-list-pane:not(.hidden)),
  html[data-initial-view="templates"] .main,
  html[data-initial-view="scaffolds"] .main,
  html[data-initial-view="projects"] .main,
  .main:has(.view.active #templateDetailPane:not(.hidden)),
  .main:has(.view.active[data-view="files"]),
  html[data-initial-view="files"] .main {
    display: block;
    height: auto;
    min-height: calc(100dvh - 68px);
    overflow: visible;
  }

  .main:has(.view.active .card-list-pane:not(.hidden)) .view.active,
  .view.active:has(.card-list-pane:not(.hidden)),
  .main:has(.view.active #templateDetailPane:not(.hidden)) .view.active,
  .view.active:has(#templateDetailPane:not(.hidden)),
  html[data-initial-view="templates"] .view[data-view="templates"],
  html[data-initial-view="scaffolds"] .view[data-view="scaffolds"],
  html[data-initial-view="projects"] .view[data-view="projects"],
  .view.active[data-view="files"],
  html[data-initial-view="files"] .view[data-view="files"] {
    height: auto;
    min-height: calc(100dvh - 68px);
    overflow: visible;
  }

  .view.active:has(.card-list-pane:not(.hidden)) .card-list-pane,
  html[data-initial-view="templates"] .view[data-view="templates"] .card-list-pane,
  html[data-initial-view="scaffolds"] .view[data-view="scaffolds"] .card-list-pane,
  html[data-initial-view="projects"] .view[data-view="projects"] .card-list-pane {
    height: auto;
    min-height: 0;
  }

  .view.active:has(.card-list-pane:not(.hidden)) .resource-card-grid,
  html[data-initial-view="templates"] .view[data-view="templates"] .resource-card-grid,
  html[data-initial-view="scaffolds"] .view[data-view="scaffolds"] .resource-card-grid,
  html[data-initial-view="projects"] .view[data-view="projects"] .resource-card-grid,
  .view.active:has(.card-list-pane:not(.hidden)) .scaffold-card-grid,
  html[data-initial-view="templates"] .view[data-view="templates"] .scaffold-card-grid,
  html[data-initial-view="scaffolds"] .view[data-view="scaffolds"] .scaffold-card-grid,
  html[data-initial-view="projects"] .view[data-view="projects"] .scaffold-card-grid,
  .file-library-list.list-view {
    overflow: visible;
  }

  .view.active[data-view="files"],
  html[data-initial-view="files"] .view[data-view="files"] {
    gap: 12px;
    height: auto;
    min-height: calc(100dvh - 68px);
    overflow: visible;
  }

  .view.active:has(#templateDetailPane:not(.hidden)) .template-detail-pane {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .view.active:has(#templateDetailPane:not(.hidden)) .template-agent-workbench.project-agent-create-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding-bottom: 16px;
  }

  .view.active:has(#templateDetailPane:not(.hidden)) .template-agent-workbench .template-agent-session-chat.project-session-chat {
    grid-column: 1;
    grid-row: 1;
    grid-template-rows: minmax(260px, auto) auto;
    height: auto;
    overflow: visible;
  }

  .view.active:has(#templateDetailPane:not(.hidden)) .template-agent-session-chat .agent-chat-log {
    max-height: 420px;
    overflow: auto;
    padding-left: var(--agent-chat-mobile-padding-x);
    padding-right: var(--agent-chat-mobile-padding-x);
  }

  .view.active:has(#templateDetailPane:not(.hidden)) .template-agent-workbench .template-agent-session-preview.project-session-preview {
    grid-column: 1;
    grid-row: 2;
    grid-template-rows: minmax(260px, auto);
    height: auto;
    min-height: 260px;
    overflow: visible;
  }

  .view.active:has(#templateDetailPane:not(.hidden)) .template-agent-output-browser {
    min-height: 260px;
  }

  .view.active:has(#templateDetailPane:not(.hidden)) .template-agent-output-browser .generated-file-list.agent-file-tree {
    --agent-tree-indent-step: 16px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    overflow: hidden;
    border-bottom: 0;
  }

  .library-page-header,
  .library-page-actions,
  .library-page-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .library-page-title {
    display: none;
  }

  .emulator-title-row {
    display: flex;
    width: 100%;
  }

  .emulator-title-row .library-page-title {
    display: block;
  }

  .library-page-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .library-page-search {
    min-width: 0;
    max-width: none;
  }

  .library-page-actions .toolbar-actions {
    display: flex;
    justify-content: flex-end;
    width: auto;
    min-width: 0;
  }

  .library-filter-tabs,
  .library-source-tabs,
  .library-view-tools {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .library-view-tools {
    overflow: visible;
  }

  .library-sort-control {
    flex: 0 0 min(242px, 72vw);
  }

  .library-sort-button {
    width: 100%;
  }

  .file-library-table-head {
    display: none;
  }

  .file-library-list.list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
    padding-right: 0;
  }

  .library-file-row,
  .file-library-list.grid-view .library-file-row {
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: stretch;
    min-height: auto;
    padding: 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .file-library-list.grid-view {
    grid-template-columns: 1fr;
  }

  .file-library-list.grid-view .library-file-row {
    padding: 14px;
  }

  .library-file-copy strong {
    font-size: 14px;
  }

  .library-file-main {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    min-height: 52px;
    padding: 0;
  }

  .file-library-list.list-view .library-modified,
  .file-library-list.list-view .library-size {
    display: none;
  }

  .library-row-actions {
    justify-content: stretch;
    gap: 8px;
  }

  .library-row-actions > * {
    flex: 1 1 0;
  }

  .resource-upload-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .project-agent-create-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }

  .project-session-chat,
  .project-session-preview {
    grid-column: 1;
    grid-row: auto;
  }

  .code-editor-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .code-editor-actions {
    align-items: flex-start;
    flex-wrap: nowrap;
  }

  .file-preview-modal.code-preview-mode .code-editor-toolbar {
    align-items: center;
    flex-direction: row;
  }

  .file-preview-modal.code-preview-mode .code-editor-actions,
  .rule-file-editor-dialog .code-editor-actions {
    flex-wrap: nowrap;
  }
}

/* P1 engineering delivery workflow */
.engineering-stat-card > div > span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.engineering-stat-card.warning .stat-icon { color: #a16207; background: #fef3c7; }
.engineering-stat-card.danger .stat-icon { color: #b42318; background: #fee4e2; }
.review-icon, .validation-icon { font-size: 22px; font-weight: 800; }
.engineering-dashboard-card .recent-list { min-height: 92px; }

.project-delivery-card { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.project-delivery-head, .project-delivery-actions, .review-summary, .review-file-actions, .emulator-run-controls, .emulator-run-summary { display: flex; align-items: center; gap: 8px; }
.project-delivery-head { justify-content: space-between; align-items: flex-start; }
.project-delivery-head > div:first-child span { display: block; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.project-delivery-head > div:first-child strong { display: block; margin-top: 3px; font-size: 15px; }
.project-delivery-actions { justify-content: flex-end; flex-wrap: wrap; }
.project-validation-summary { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.validation-finding-list, .project-release-list, .change-review-list, .emulator-findings, .emulator-call-graph { display: grid; gap: 7px; margin-top: 10px; }
.validation-finding, .project-release-row, .change-review-row, .emulator-finding, .call-graph-row { padding: 9px 10px; color: var(--text); border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 12px; }
.validation-finding.error, .emulator-finding.error { border-color: rgba(255, 93, 93, .45); background: rgba(255, 93, 93, .08); }
.validation-finding.warning, .emulator-finding.warning { border-color: rgba(255, 184, 77, .4); background: rgba(255, 184, 77, .07); }
.project-release-row, .change-review-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.project-release-row a { color: var(--accent); font-weight: 700; }

.change-review-panel { display: grid; gap: 8px; min-height: 0; margin-bottom: 10px; }
.change-review-list { max-height: 180px; overflow: auto; padding-right: 3px; }
.review-summary { justify-content: space-between; color: var(--muted); font-size: 11px; }
.review-summary > div:first-child { display: grid; gap: 2px; min-width: 0; }
.review-summary strong { color: var(--text); font-size: 12px; }
.review-batch-actions { flex: 0 0 auto; }
.change-review-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.change-review-row[data-decision="accepted"] { border-color: rgba(61, 220, 151, .45); background: rgba(61, 220, 151, .08); }
.change-review-row[data-decision="rejected"] { opacity: .7; }
.review-file-actions button { min-height: 28px; padding: 4px 8px; color: var(--text); border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface-3); cursor: pointer; font-size: 11px; }
.review-file-actions button.is-active { border-color: var(--accent); color: var(--accent); }

.emulator-page-toolbar { justify-content: space-between; }
.emulator-run-controls select { min-width: 260px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); padding: 0 10px; }
.emulator-results { display: grid; gap: 14px; }
.emulator-run-summary { justify-content: space-between; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.emulator-result-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 14px; }
.call-graph-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.call-graph-row.is-missing { color: #b42318; }

@media (max-width: 900px) {
  .project-delivery-head, .project-release-row, .change-review-row, .emulator-page-toolbar, .emulator-run-controls, .emulator-run-summary { align-items: stretch; flex-direction: column; }
  .project-delivery-actions, .review-file-actions { justify-content: flex-start; }
  .emulator-run-controls select { width: 100%; min-width: 0; }
  .emulator-result-grid { grid-template-columns: 1fr; }
}
