:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-soft: #f3f3f0;
  --surface-hover: #ececea;
  --border: #deded8;
  --border-strong: #c9c9c2;
  --text: #111111;
  --muted: #666660;
  --muted-soft: #8a8a84;
  --green: #10a37f;
  --green-soft: #e7f8f2;
  --red: #d92d20;
  --red-soft: #fff0ef;
  --blue: #2563eb;
  --focus-ring: rgba(16, 163, 127, .24);
  --shadow: 0 10px 28px rgba(17, 17, 17, .07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .72; }
a { color: inherit; text-decoration: none; }

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

.home-page {
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: linear-gradient(180deg, #f7f7f4 0%, #f2f2ef 100%);
  color: var(--text);
}
body.studio-active .home-page {
  display: none;
}

body.research-active .home-page > section:not(.research-workbench) {
  display: none;
}
body:not(.preset-active) .preset-library-page {
  display: none;
}
body.preset-active .home-page > section:not(.preset-library-page):not(.preset-detail-modal) {
  display: none;
}
body.market-active .home-page > section:not(.home-market-section) {
  display: none;
}

.home-hero {
  position: relative;
  display: flex;
  min-height: calc(100svh - 24px);
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background-image: url("home-hero-lan-safe.png");
  background-position: center;
  background-size: cover;
  padding: 92px clamp(20px, 3.75vw, 72px) 72px;
}
.home-nav {
  position: absolute;
  inset: 0 0 auto;
  z-index: 30;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid rgba(17, 17, 17, .06);
  background: rgba(247, 247, 244, .82);
  backdrop-filter: blur(22px) saturate(1.15);
}
.home-brand,
.home-nav-links,
.home-nav-actions,
.home-nav-action,
.home-admin-link,
.home-primary,
.home-secondary {
  display: inline-flex;
  align-items: center;
}
.home-brand {
  gap: 10px;
  font-weight: 760;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #b8ded2;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
}
.brand-mark img {
  display: block;
  width: 29px;
  height: 29px;
  object-fit: contain;
}
.home-nav-links {
  flex: 1;
  justify-content: center;
  gap: clamp(16px, 3vw, 34px);
  min-width: 0;
}
.home-nav-links a {
  color: rgba(17, 17, 17, .7);
  font-size: 13px;
  font-weight: 720;
}
.home-nav-links a:hover { color: #111; }
.home-nav-actions {
  justify-content: flex-end;
  gap: 10px;
}
.home-nav-action,
.home-admin-link,
.home-primary,
.home-secondary {
  min-height: 42px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 760;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.home-nav-action {
  padding: 0 16px;
  border: 1px solid rgba(17,17,17,.14);
  background: rgba(255, 255, 255, .88);
}
.home-admin-link {
  gap: 7px;
  padding: 0 14px;
  border: 1px solid rgba(17, 17, 17, .12);
  background: rgba(17, 17, 17, .88);
  color: #fff;
}
.home-nav-action:hover,
.home-admin-link:hover,
.home-primary:hover,
.home-secondary:hover {
  transform: translateY(-1px);
}
.home-hero-copy {
  z-index: 2;
  width: min(760px, 100%);
}
.home-hero-logo {
  position: absolute;
  right: clamp(28px, 9vw, 148px);
  top: clamp(108px, 17vh, 168px);
  z-index: 1;
  width: clamp(128px, 18vw, 256px);
  height: auto;
  opacity: .94;
  filter: drop-shadow(0 22px 42px rgba(10,109,92,.18));
  pointer-events: none;
}
.home-kicker {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--green);
  font-size: 13px;
  font-weight: 780;
}
.home-hero h1 {
  margin: 0;
  color: #0c0c0d;
  font-size: clamp(82px, 6.1vw, 116px);
  font-weight: 820;
  letter-spacing: 0;
  line-height: .98;
}
.home-hero-copy p {
  width: min(590px, 100%);
  margin: 22px 0 0;
  color: #383a36;
  font-size: 24px;
  line-height: 1.48;
}
.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.home-primary {
  gap: 8px;
  padding: 0 18px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
}
.home-primary:hover { box-shadow: 0 10px 24px rgba(17,17,17,.08); }
.home-secondary {
  padding: 0 16px;
  border: 1px solid rgba(17,17,17,.14);
  background: rgba(255,255,255,.72);
}
.home-metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}
.home-metric {
  min-width: 126px;
  padding: 12px 14px;
  border: 1px solid rgba(17,17,17,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.62);
  backdrop-filter: blur(12px);
}
.home-metric strong,
.home-metric span { display: block; }
.home-metric strong {
  color: #111;
  font-size: 18px;
  line-height: 1.2;
}
.home-metric span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.home-flow,
.home-analysis-showcase,
.home-agent-section,
.home-insight {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 78px 0;
}
.home-flow {
  display: grid;
  gap: 34px;
}
.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.home-feature {
  display: grid;
  min-height: 190px;
  align-content: end;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(242,243,240,.94));
  box-shadow: 0 14px 34px rgba(17,17,17,.055);
}
.home-feature strong {
  font-size: 19px;
}
.home-feature p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.58;
}
.home-product-showcase {
  display: grid;
  gap: 34px;
  padding: 86px clamp(20px, 5vw, 72px);
  background: #111;
  color: #fff;
}
.home-product-showcase .home-showcase-copy {
  width: min(920px, 100%);
}
.home-product-showcase .home-kicker {
  color: #85d8c1;
}
.home-product-showcase h2 {
  color: #fff;
}
.home-product-showcase p {
  width: min(760px, 100%);
  color: rgba(255,255,255,.72);
}
.home-preview-frame,
.home-analysis-media {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  box-shadow: 0 24px 70px rgba(0,0,0,.22);
}
.home-preview-frame img,
.home-analysis-media img {
  display: block;
  width: 100%;
  height: auto;
}
.home-preview-frame-wide {
  max-height: 680px;
  margin: 0;
  border-color: rgba(255,255,255,.2);
}
.home-preview-frame-wide img {
  object-fit: cover;
  object-position: left top;
}
.home-analysis-showcase {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
}
.home-analysis-media {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 20px 54px rgba(17,17,17,.1);
}
.home-showcase-copy h2,
.home-section-copy h2,
.home-insight h2 {
  margin: 0;
  color: #0c0c0d;
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 820;
  line-height: 1.02;
}
.home-showcase-copy p,
.home-section-copy p,
.home-insight p {
  margin: 18px 0 0;
  color: #4b4b46;
  font-size: 17px;
  line-height: 1.75;
}
.home-detail-list {
  display: grid;
  gap: 14px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}
.home-detail-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  color: #3e403b;
  font-size: 15px;
  line-height: 1.65;
}
.home-detail-list span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  margin-top: 3px;
  border: 1px solid #9fd9ca;
  border-radius: 999px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}
.home-agent-section {
  display: grid;
  gap: 24px;
  border-top: 0;
}
.home-section-copy {
  width: min(720px, 100%);
}
.home-agent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 0;
}
.home-agent-card {
  display: grid;
  min-height: 210px;
  align-content: start;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(17,17,17,.1);
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 18px 60px rgba(17,17,17,.06);
}
.home-agent-card div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.home-agent-card div span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: #111;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.home-agent-card strong {
  font-size: 17px;
}
.home-agent-card p,
.home-agent-card small {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.home-agent-card a {
  display: inline-flex;
  width: fit-content;
  min-height: 32px;
  align-items: center;
  margin-top: 2px;
  padding: 0 12px;
  border: 1px solid #b8ded2;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}
.home-insight {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(320px, 1fr) auto;
  min-height: 100svh;
  align-items: center;
  gap: 36px;
  border-top: 1px solid rgba(17,17,17,.08);
  padding-bottom: 108px;
  scroll-margin-top: 0;
}
.home-market-section {
  min-height: 100vh;
  padding: 0 0 44px;
  background:
    linear-gradient(90deg, rgba(16,163,127,.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(16,163,127,.055) 1px, transparent 1px),
    #fafaf7;
  background-size: 64px 64px, 64px 64px, auto;
}
.square-topbar-inline {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1336px, calc(100% - 48px));
  margin: 0 auto;
  border-bottom: 1px solid rgba(17,17,17,.07);
  background: rgba(247,247,244,.82);
  backdrop-filter: blur(22px) saturate(1.12);
}
.square-nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.square-brand {
  border: 0;
  background: transparent;
}
.square-hero-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px) auto;
  align-items: end;
  gap: 48px;
  width: min(1336px, calc(100% - 48px));
  margin: 0 auto;
  padding: 96px 0 24px;
}
.square-hero-inline h2 {
  margin: 9px 0 0;
  color: #0b0d0c;
  font-size: 96px;
  font-weight: 820;
  line-height: .96;
}
.square-hero-inline p {
  max-width: 680px;
  margin: 16px 0 0;
  color: #4b4d47;
  font-size: 16px;
  line-height: 1.65;
}
.square-quota-strip {
  display: grid;
  grid-template-columns: minmax(0,1.1fr) auto auto auto auto auto auto;
  align-items: center;
  gap: 8px 10px;
  width: 464px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(17,17,17,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
}
.square-quota-strip span,
.square-quota-strip small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.square-quota-strip strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 840;
}
.square-register-card {
  display: grid;
  gap: 10px;
  min-width: 360px;
  padding: 14px;
  border: 1px solid rgba(17,17,17,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
}
.square-register-card strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 880;
}
.square-register-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.square-register-form input {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--text);
  padding: 0 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  outline: none;
}
.square-register-form input:focus {
  border-color: #9cc8af;
  background: #fff;
}
.square-register-form button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #0b8f72;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 850;
}
.square-refresh-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  justify-self: end;
  margin-top: 28px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.9);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}
.square-tabs {
  display: flex;
  width: min(1336px, calc(100% - 48px));
  align-items: center;
  gap: 6px;
  margin: 0 auto 18px;
  padding: 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.square-tabs button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}
.square-tabs button.active,
.square-tabs button:hover {
  border-color: var(--border);
  background: #fff;
  color: var(--text);
}
.square-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 286px), 1fr));
  gap: 14px;
  width: min(1336px, calc(100% - 48px));
  margin: 0 auto;
}
.square-card {
  display: grid;
  overflow: hidden;
  width: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.square-card-image {
  display: block;
  aspect-ratio: 1 / 1;
  margin: 0;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(45deg, rgba(17,17,17,.045) 25%, transparent 25% 75%, rgba(17,17,17,.045) 75%),
    linear-gradient(45deg, rgba(17,17,17,.045) 25%, transparent 25% 75%, rgba(17,17,17,.045) 75%),
    #f1f1ee;
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
}
.square-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.square-card-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}
.square-card-head {
  display: grid;
  gap: 3px;
}
.square-card-body strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 820;
}
.square-card-head span {
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}
.square-card-body p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #484a45;
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.square-card-meta,
.square-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.square-card-meta span {
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f7f8f5;
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}
.square-card-actions button {
  min-height: 32px;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--text);
  font-size: 12px;
  font-weight: 820;
}
.square-card-actions button:first-child {
  border-color: #b8ded2;
  background: var(--green-soft);
  color: var(--green);
}
.square-empty-card {
  display: grid;
  gap: 8px;
  min-height: 180px;
  align-content: center;
  padding: 22px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
}
.square-empty-card strong {
  color: var(--text);
  font-size: 18px;
}
.square-empty-card p,
.square-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.square-status {
  width: min(1336px, calc(100% - 48px));
  margin: 14px auto 0;
}
.square-status[data-tone="success"] {
  color: var(--green);
}
.square-status[data-tone="error"] {
  color: var(--red);
}
.home-primary.dark {
  border: 1px solid rgba(17,17,17,.14);
  background: rgba(255,255,255,.94);
  color: #111;
  white-space: nowrap;
}

.studio-view {
  display: none;
}
body.studio-active .studio-view {
  display: block;
}

body.research-active .studio-view {
  display: none;
}

.app-shell {
  --left-sidebar-width: 280px;
  --settings-panel-width: 350px;
  --left-column: 0px;
  --right-column: var(--settings-panel-width);
  display: grid;
  grid-template-columns: var(--left-column) minmax(0, 1fr) var(--right-column);
  width: 100vw;
  height: 100vh;
  min-height: 720px;
  overflow: hidden;
  background: var(--bg);
}
.app-shell.left-open {
  --left-column: var(--left-sidebar-width);
}
.app-shell:not(.left-open) .sidebar {
  display: none;
}
.app-shell:not(.settings-open) {
  --right-column: 0px;
}
.app-shell:not(.settings-open) .settings-panel {
  display: none;
}
.sidebar,
.settings-panel {
  min-width: 0;
  min-height: 0;
  background: var(--surface-soft);
  border-color: var(--border);
  border-style: solid;
}
.sidebar {
  grid-column: 1;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 18px 14px;
  border-width: 0 1px 0 0;
}
.brand {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}
.brand-main .brand-mark {
  width: 38px;
  height: 38px;
}
.brand-main .brand-mark img {
  width: 100%;
  height: 100%;
}
.brand strong,
.panel-header strong,
.empty-state strong {
  display: block;
  font-size: 15px;
  font-weight: 720;
}
.brand span,
.panel-header span,
.empty-state span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.icon-button,
.topbar-toggle,
.new-task,
.subtle-button,
.primary-action,
.danger-action,
.send-button,
.clear-prompt-button,
.upload-button,
.preset-button,
.prompt-optimize-button,
.quick-config-button,
.agent-chip,
.status-pill,
.topbar-home-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--muted);
}
.icon-button:hover,
.subtle-button:hover,
.history-toggle:hover,
.history-day-select:hover,
.clear-prompt-button:hover,
.new-task:hover {
  border-color: var(--border-strong);
  background: #fff;
}
.icon-button.context-active {
  border-color: #ffd4d0;
  background: var(--red-soft);
  color: var(--red);
}
.new-task {
  width: 100%;
  height: 42px;
  gap: 8px;
  border-color: var(--border-strong);
  background: #fff;
  color: var(--text);
  font-weight: 650;
}
.history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.history-toggle {
  display: inline-flex;
  min-width: 0;
  flex: 1;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--text);
  font-size: 12px;
  font-weight: 820;
}
.history-toggle.active {
  border-color: #9cc8af;
  background: var(--green-soft);
  color: var(--green);
}
.history-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}
.history-day-group {
  display: grid;
  gap: 6px;
}
.history-day-group.selected {
  padding: 6px;
  border: 1px solid #9cc8af;
  border-radius: 10px;
  background: #f6fffb;
}
.history-day-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}
.history-day-toggle,
.history-day-select {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f5f5f1;
  color: var(--text);
  text-align: left;
}
.history-day-select {
  width: auto;
  min-width: 48px;
  justify-content: center;
  padding: 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}
.history-day-group.selected .history-day-select {
  border-color: #9cc8af;
  background: var(--green-soft);
  color: var(--green);
}
.history-day-toggle strong {
  font-size: 12px;
  font-weight: 900;
}
.history-day-toggle span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}
.history-day-toggle[aria-expanded="true"] {
  border-color: #9cc8af;
  background: #f6fffb;
}
.history-day-list {
  display: grid;
  gap: 8px;
}
.history-industry-group {
  display: grid;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(220,220,216,.72);
  border-radius: 10px;
  background: rgba(255,255,255,.48);
}
.history-industry-group.active {
  border-color: #9cc8af;
  background: linear-gradient(180deg, #f6fffb, #fff);
}
.history-industry-head {
  display: grid;
  width: 100%;
  min-height: 30px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.history-industry-head:hover,
.history-industry-head[aria-expanded="true"] {
  background: #f6f6f3;
}
.history-industry-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-industry-meta {
  min-width: 38px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #eef4ef;
  color: var(--muted);
  font-size: 11px;
  font-weight: 860;
  text-align: center;
}
.history-industry-list {
  display: grid;
  gap: 5px;
}
.history-item {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}
.history-item:hover,
.history-item.active {
  border-color: var(--border-strong);
  background: #fff;
}
.history-industry-group.active .history-item.active {
  border-color: #9cc8af;
  box-shadow: 0 8px 18px rgba(16, 163, 127, .12);
}
.history-item strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 640;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item span,
.empty-history {
  color: var(--muted);
  font-size: 12px;
}
.history-item.running { border-color: #e1c075; }
.history-item.success { border-color: #9fd9ca; }
.history-item.error { border-color: #efb4af; }
.empty-history {
  display: grid;
  min-height: 64px;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.workspace {
  grid-column: 2;
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
}
.topbar {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
}
.topbar-cluster {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}
.topbar-cluster.right { justify-content: flex-end; }
.topbar-toggle {
  width: 34px;
  height: 34px;
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--green);
  font-weight: 800;
}
.topbar-toggle.active {
  border-color: #9cc8af;
  background: var(--green-soft);
}
.topbar-home-button,
.status-pill {
  min-height: 34px;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 740;
  line-height: 1;
  white-space: nowrap;
}
.status-pill {
  color: var(--muted);
  font-weight: 700;
}
.media-count-pill {
  min-width: 58px;
  cursor: pointer;
}
.media-count-pill:hover {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--text);
}
.media-count-pill.return-all {
  border-color: #9cc8af;
  background: var(--green-soft);
  color: var(--green);
}
.connection-status.success,
.status-line.success {
  border-color: #b8ded2;
  background: var(--green-soft);
  color: var(--green);
}
.connection-status.error,
.status-line.error {
  color: var(--red);
}
.connection-status.loading,
.status-line.loading {
  color: var(--muted);
}
.current-model {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.current-model strong {
  color: var(--text);
  font-weight: 800;
}

.canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 26px 26px 210px;
  background:
    radial-gradient(circle at 50% 42%, rgba(17,17,17,.035), transparent 34%),
    var(--surface);
}
.empty-state {
  position: absolute;
  left: 50%;
  top: 45%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: min(460px, calc(100% - 48px));
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.68);
  box-shadow: 0 14px 42px rgba(17,17,17,.08);
  text-align: left;
  transform: translate(-50%, -50%);
}
.empty-mark {
  display: grid !important;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--green) !important;
  font-size: 20px !important;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.gallery-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}
.gallery-title strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 880;
}
.gallery-title span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 780;
}
.gallery-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.gallery-bulk-actions > span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  color: #2563eb;
  font-size: 13px;
  font-weight: 860;
}
.gallery-bulk-actions button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 780;
}
.gallery-bulk-actions button.danger {
  border-color: #ffd4d0;
  color: var(--red);
}
.gallery-bulk-actions button.retry,
.image-actions button.retry {
  border-color: #9cc8af;
  background: var(--green-soft);
  color: #0f6f5a;
}
.gallery-bulk-actions.muted > span {
  color: var(--muted);
}
.image-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(17,17,17,.08);
}
.image-card.selected {
  border-color: #77aee8;
  box-shadow: 0 0 0 2px rgba(37,99,235,.15), 0 16px 38px rgba(17,17,17,.08);
}
.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--surface-soft);
}
.failed-preview {
  display: grid;
  aspect-ratio: 1 / 1;
  place-items: center;
  align-content: center;
  gap: 18px;
  background:
    linear-gradient(45deg, rgba(17,17,17,.045) 25%, transparent 25% 75%, rgba(17,17,17,.045) 75%),
    linear-gradient(45deg, rgba(17,17,17,.045) 25%, transparent 25% 75%, rgba(17,17,17,.045) 75%),
    #f7f7f5;
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
}
.failed-preview span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid var(--red);
  border-radius: 999px;
  color: var(--red);
  font-size: 22px;
  font-weight: 900;
}
.failed-preview strong {
  color: var(--red);
  font-size: 22px;
  font-weight: 900;
}
.failed-preview div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.failed-preview button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #ffaaa4;
  border-radius: 999px;
  background: #fff;
  color: var(--red);
  font-size: 14px;
  font-weight: 850;
}
.image-select {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: rgba(17,17,17,.54);
}
.image-card.selected .image-select {
  background: var(--green);
}
.image-select span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}
.image-index {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(17,17,17,.5);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}
.image-card-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}
.image-card-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.image-card-line strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 880;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-time {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 7px;
  border: 1px solid #ffaaa4;
  border-radius: 999px;
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
}
.image-badges,
.image-agent-tag {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.image-badges span,
.image-agent-tag {
  min-height: 22px;
  align-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}
.image-agent-tag {
  display: inline-flex;
  width: fit-content;
  background: var(--green-soft);
  color: var(--green);
}
.image-error {
  overflow: hidden;
  padding: 3px 8px;
  border: 1px solid #ffb8b2;
  border-radius: 8px;
  background: #fff0ef;
  color: var(--red);
  font-size: 12px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-card p {
  overflow: hidden;
  display: -webkit-box;
  min-height: 32px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.image-actions {
  display: flex;
  gap: 7px;
}
.image-actions a,
.image-actions button {
  display: inline-flex;
  min-height: 30px;
  flex: 1;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fbfbfa;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  text-decoration: none;
}

.composer {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 4;
  display: grid;
  width: min(930px, calc(100% - 36px));
  gap: 6px;
  transform: translateX(-50%);
}
.agent-mode-strip {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(220,220,216,.72);
  border-radius: 14px;
  background: rgba(255,255,255,.58);
  box-shadow: 0 12px 34px rgba(17,17,17,.1), inset 0 1px rgba(255,255,255,.65);
  backdrop-filter: blur(18px) saturate(1.16);
}
.agent-mode-strip strong,
.agent-mode-strip span {
  display: block;
}
.agent-mode-strip strong {
  font-size: 13px;
  font-weight: 780;
}
.agent-mode-strip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.agent-mode-toggle {
  position: relative;
  display: inline-flex;
  width: 62px;
  height: 36px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--text);
  text-indent: -999px;
  overflow: hidden;
}
.agent-mode-toggle.active {
  border: 1px solid #9cc8af;
  background: var(--green);
}
.agent-mode-toggle::after {
  content: "✣";
  position: absolute;
  right: 7px;
  top: 6px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  color: #111;
  font-size: 13px;
  box-shadow: 0 3px 9px rgba(17,17,17,.12);
}
.agent-mode-toggle.active::after {
  color: var(--green);
  transform: translateX(-24px);
}
.agent-mode-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 18px;
  border: 1px solid rgba(220,220,216,.72);
  border-radius: 16px;
  background: rgba(255,255,255,.7);
  box-shadow: 0 12px 34px rgba(17,17,17,.1), inset 0 1px rgba(255,255,255,.7);
  backdrop-filter: blur(18px) saturate(1.16);
}
.agent-mode-card > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}
.agent-mode-card strong,
.agent-mode-card p {
  display: block;
  margin: 0;
}
.agent-mode-card strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 840;
}
.agent-mode-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}
.agent-mode-card button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.82);
  color: #111;
  font-size: 22px;
  line-height: 1;
}
.agent-quickbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 7px;
  min-width: 0;
  padding: 5px;
  border: 1px solid rgba(220,220,216,.72);
  border-radius: 14px;
  background: rgba(255,255,255,.62);
  box-shadow: 0 12px 34px rgba(17,17,17,.11), inset 0 1px rgba(255,255,255,.65);
  backdrop-filter: blur(18px) saturate(1.16);
}
.agent-quickbar > .agent-entry-button,
.agent-quickbar > #expandAdvanced,
.agent-quickbar > .agent-clear-button,
.agent-quickbar > .agent-applied-status,
.agent-quickbar > .agent-status-bubble {
  flex-shrink: 0;
}
.agent-chip,
.subtle-button {
  min-height: 32px;
  gap: 6px;
  padding: 0 10px;
  border-color: var(--border);
  background: rgba(255,255,255,.7);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.subtle-button { color: var(--text); }
.agent-entry-button {
  position: relative;
  min-width: 196px;
  flex: 0 0 210px;
  justify-content: flex-start;
}
.agent-entry-button small {
  position: absolute;
  right: 12px;
  top: -11px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
}
.agent-entry-button.active {
  border-color: #9cc8af;
  background: var(--green-soft);
  color: var(--green);
}
.agent-entry-button.is-selected {
  border-color: #b8ded2;
  background: #fff;
  color: var(--text);
}
.agent-entry-button.is-applied {
  border-color: #9cc8af;
  background: #e7f8f2;
  color: #0b7d63;
}
.agent-clear-button,
.agent-applied-status button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}
.agent-applied-status {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 7px 0 10px;
  border: 1px solid #b8ded2;
  border-radius: 999px;
  background: #f2fffb;
  color: var(--green);
  font-size: 12px;
  font-weight: 820;
}
.agent-applied-status button {
  width: 22px;
  height: 22px;
  border-color: #b8ded2;
  color: var(--green);
}
.agent-status-bubble {
  flex: 0 0 auto;
  min-height: 30px;
  margin-left: auto;
  padding: 7px 11px;
  border: 1px solid #b8ded2;
  border-radius: 999px;
  background: #f2fffb;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}
.agent-quick-list {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 1px;
  scrollbar-width: thin;
}
.composer.agent-collapsed:not(.agent-applied) .agent-quickbar,
.composer.agent-mode-enabled .agent-quickbar {
  display: flex;
}
.composer.agent-collapsed .agent-quick-list {
  display: none;
}
.composer.agent-mode-enabled .composer-main {
  align-items: start;
}
.composer.agent-mode-enabled .composer-main textarea {
  height: 62px;
  min-height: 62px;
  max-height: 160px;
  padding-top: 12px;
  line-height: 1.55;
}
.agent-quick-chip {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 780;
}
.agent-quick-chip span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  background: #111;
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}
.agent-quick-chip strong {
  font-size: 12px;
}
.agent-quick-chip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.agent-quick-chip.active {
  border-color: #9cc8af;
  background: var(--green-soft);
  color: var(--green);
}
.agent-quick-chip.active span {
  background: var(--green);
}
.preset-panel {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(220,220,216,.86);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 16px 46px rgba(17,17,17,.12), inset 0 1px rgba(255,255,255,.72);
  backdrop-filter: blur(20px) saturate(1.1);
}
.preset-panel header {
  display: grid;
  gap: 4px;
  padding-right: 56px;
}
.preset-panel header strong {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
}
.preset-panel header p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}
.preset-library-page {
  min-height: 100vh;
  padding: 22px clamp(18px, 4vw, 64px) 56px;
  background: #f7f7f5;
}
.preset-library-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  margin: -22px calc(clamp(18px, 4vw, 64px) * -1) 22px;
  padding: 10px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid rgba(17,17,17,.08);
  background: rgba(247,247,245,.88);
  backdrop-filter: blur(18px) saturate(1.08);
}
.preset-library-head {
  display: grid;
  gap: 10px;
  max-width: 980px;
  margin: 0 auto 22px;
}
.preset-library-head h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}
.preset-library-head p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.62;
}
.preset-page-panel {
  max-width: 1360px;
  margin: 0 auto;
}
.preset-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 10px;
}
.preset-toolbar input {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfbfa;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 760;
  outline: none;
}
.preset-toolbar input:focus {
  border-color: #9cc8af;
  background: #fff;
}
.preset-toolbar span,
.preset-footer span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}
.preset-panel-close {
  position: absolute;
  right: 18px;
  top: 18px;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: #111;
  font-size: 24px;
}
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 18px;
}
.preset-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 360px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-align: left;
}
.preset-card.has-image {
  grid-template-rows: 220px auto auto minmax(0, 1fr) auto;
}
.preset-card:hover {
  border-color: #9cc8af;
  background: #fbfffd;
}
.preset-card figure {
  overflow: hidden;
  margin: -4px -4px 2px;
  border: 1px solid rgba(220,220,216,.74);
  border-radius: 10px;
  background: #f3f3ef;
}
.preset-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preset-card span {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #b8ded2;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 15px;
  font-weight: 900;
}
.preset-card-head {
  display: grid;
  gap: 8px;
}
.preset-card strong {
  color: var(--text);
  font-size: 21px;
  line-height: 1.16;
  font-weight: 900;
}
.preset-card-block {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.preset-card-block b {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}
.preset-card-block p {
  overflow: hidden;
  display: -webkit-box;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}
.preset-card-block.prompt-block p {
  color: var(--text);
  -webkit-line-clamp: 14;
  white-space: pre-line;
}
.preset-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.preset-card-actions button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--text);
  font-size: 13px;
  font-weight: 880;
  cursor: pointer;
}
.preset-card-actions button:first-child {
  border-color: rgba(15, 111, 90, .25);
  background: var(--green-soft);
  color: var(--green);
}
.preset-card-actions button:hover {
  border-color: #9cc8af;
  background: #fff;
}
.preset-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.preset-pagination {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.preset-pagination button {
  min-width: 76px;
}
.preset-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(17,17,17,.42);
  backdrop-filter: blur(8px);
}
.preset-detail-modal.hidden {
  display: none;
}
.preset-detail-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(0, 620px);
  width: min(1180px, 100%);
  max-height: min(860px, calc(100vh - 44px));
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
}
.preset-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: #111;
  font-size: 24px;
  cursor: pointer;
}
.preset-detail-image {
  min-height: 0;
  margin: 0;
  overflow: auto;
  background: #f2f2ef;
}
.preset-detail-image img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 100%;
  object-fit: contain;
}
.preset-detail-image.hidden {
  display: none;
}
.preset-detail-image.hidden + .preset-detail-content {
  grid-column: 1 / -1;
}
.preset-detail-content {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 28px;
}
.preset-detail-content h2 {
  margin: 0;
  color: var(--text);
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}
.preset-detail-content p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.preset-detail-prompt {
  display: grid;
  gap: 8px;
}
.preset-detail-prompt strong {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}
.preset-detail-prompt textarea {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfbfa;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.65;
}
.preset-detail-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}
.preset-detail-meta a {
  color: var(--green);
  font-weight: 880;
  text-decoration: none;
}
.preset-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.preset-pagination button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.preset-pagination span {
  min-width: 92px;
  text-align: center;
}
.prompt-analysis-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(220,220,216,.86);
  border-radius: 18px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 16px 46px rgba(17,17,17,.12), inset 0 1px rgba(255,255,255,.72);
  backdrop-filter: blur(20px) saturate(1.1);
}
.prompt-analysis-card header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-right: 56px;
}
.analysis-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 20px;
  font-weight: 900;
}
.prompt-analysis-card header strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 880;
}
.prompt-analysis-card header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 16px;
}
.prompt-analysis-close {
  position: absolute;
  right: 18px;
  top: 18px;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: #111;
  font-size: 24px;
}
.analysis-ready-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 16px;
}
.analysis-ready-row strong {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 15px;
  font-weight: 900;
}
.preflight-generate {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #b8ded2;
  border-radius: 12px;
  background: #f2fffb;
}
.preflight-copy {
  display: flex;
  align-items: center;
  gap: 28px;
  color: var(--muted);
  font-size: 16px;
}
.preflight-copy strong {
  color: var(--green);
  font-size: 20px;
  font-weight: 900;
}
.preflight-track {
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: #dcebe6;
}
.preflight-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width .3s ease;
}
.preflight-generate button {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 17px;
  font-weight: 880;
}
.preflight-generate.paused {
  border-color: #edd28a;
  background: #fff8e8;
}
.preflight-generate.paused .preflight-copy,
.preflight-generate.paused .preflight-copy strong {
  color: #8a6400;
}
.preflight-generate.paused .preflight-track span {
  background: #d79a00;
}
.analysis-block {
  display: grid;
  gap: 10px;
}
.analysis-block > strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
}
.analysis-warning {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f5f5f2;
}
.analysis-warning b {
  color: var(--text);
  font-size: 16px;
}
.analysis-warning span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}
.analysis-param-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.analysis-param-grid div {
  display: grid;
  gap: 4px;
  min-height: 60px;
  align-content: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f5f5f2;
}
.analysis-param-grid span {
  color: var(--muted);
  font-size: 14px;
}
.analysis-param-grid b {
  color: var(--text);
  font-size: 16px;
}
.prompt-analysis-card textarea {
  width: 100%;
  min-height: 180px;
  max-height: 260px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfbfa;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.62;
  resize: vertical;
  white-space: pre-wrap;
}
.analysis-style-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.analysis-style-tags span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fbfbfa;
  color: var(--muted);
  font-size: 14px;
  font-weight: 820;
}
.analysis-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.analysis-actions .primary-action.compact,
.analysis-actions .subtle-button.compact {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 850;
}
.analysis-actions .copy-analysis-button {
  min-width: 126px;
  border-color: var(--border-strong);
  background: rgba(255,255,255,.82);
}
.composer-main {
  display: grid;
  grid-template-columns: 38px minmax(76px, auto) minmax(104px, auto) minmax(240px, 1fr) minmax(112px, max-content) 40px 40px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(220,220,216,.84);
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 18px 44px rgba(17,17,17,.16), inset 0 1px rgba(255,255,255,.8);
  backdrop-filter: blur(20px) saturate(1.15);
}
.upload-button,
.preset-button,
.prompt-optimize-button,
.quick-config-button,
.send-button,
.clear-prompt-button {
  min-height: 38px;
  border-color: #b8ded2;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 850;
}
.upload-button,
.send-button,
.clear-prompt-button {
  width: 38px;
  padding: 0;
}
.preset-button {
  gap: 6px;
  padding: 0 13px;
}
.prompt-optimize-button {
  gap: 6px;
  padding: 0 12px;
  border-color: #111;
  background: #111;
  color: #fff;
  border-radius: 12px;
  white-space: nowrap;
}
.prompt-optimize-button:disabled {
  border-color: var(--border);
  background: #f4f4f1;
  color: var(--muted-soft);
}
.quick-config-button {
  gap: 7px;
  max-width: 154px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quick-config-button:hover {
  border-color: #9cc8af;
  background: #f2fffb;
}
.send-button {
  border-color: #111;
  background: #111;
  color: #fff;
}
.clear-prompt-button {
  border-color: var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 18px;
}
.quick-config-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(184,222,210,.95);
  border-radius: 16px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 14px 36px rgba(17,17,17,.12), inset 0 1px rgba(255,255,255,.72);
  backdrop-filter: blur(18px) saturate(1.12);
}
.quick-config-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.quick-config-panel header strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
}
.quick-config-panel header button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 20px;
}
.quick-config-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.quick-config-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.quick-config-grid input,
.quick-config-grid select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfbfa;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  outline: none;
}
.quick-config-grid input:focus,
.quick-config-grid select:focus {
  border-color: #9cc8af;
  background: #fff;
}
.composer-main textarea {
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 130px;
  min-width: 0;
  padding: 12px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  resize: none;
  line-height: 1.45;
}
.composer.agent-applied .composer-main {
  align-items: start;
}
.composer.agent-applied .composer-main textarea {
  height: 160px;
  min-height: 160px;
  max-height: 220px;
  padding: 12px 10px;
  line-height: 1.55;
}
.composer-tools {
  display: none;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 6px;
}
.composer.agent-applied .composer-tools,
.composer.has-prompt .composer-tools {
  display: flex;
}
.composer-tools button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(220,220,216,.78);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 780;
  box-shadow: 0 8px 18px rgba(17,17,17,.07), inset 0 1px rgba(255,255,255,.7);
}
.composer-tools button:disabled {
  color: var(--muted-soft);
  background: rgba(255,255,255,.48);
  box-shadow: none;
}
.agent-model-intro {
  margin: -2px 0 8px;
  padding: 10px 12px;
  border: 1px solid #b8ded2;
  border-radius: 12px;
  background: #f2fffb;
  color: #245649;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.48;
}
.composer-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 24px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}
.composer-meta > span,
.composer-auto-toggle {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid rgba(220,220,216,.72);
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  box-shadow: 0 8px 20px rgba(17,17,17,.08), inset 0 1px rgba(255,255,255,.62);
  backdrop-filter: blur(14px) saturate(1.12);
}
.composer-meta > span:first-child {
  min-width: 0;
  margin-right: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-auto-toggle input {
  width: 13px;
  height: 13px;
  accent-color: var(--green);
}
.hidden { display: none !important; }
.hidden-input { display: none; }

.agent-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(17,17,17,.48);
  backdrop-filter: blur(10px);
}
.agent-modal.hidden { display: none; }
.agent-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1810px, calc(100vw - 68px));
  height: min(1230px, calc(100vh - 88px));
  overflow: hidden;
  border: 1px solid rgba(17,17,17,.13);
  border-radius: 16px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 34px 110px rgba(0,0,0,.34);
}
.agent-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.agent-panel-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.agent-panel-head strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 24px;
  font-weight: 820;
}
.agent-panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 15px;
}
.agent-layout {
  display: grid;
  min-height: 0;
  grid-template-columns: 330px minmax(0, 1fr);
}
.agent-list {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 22px;
  border-right: 1px solid var(--border);
  background: #f8f8f6;
}
.agent-list-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-align: left;
}
.agent-list-item:hover,
.agent-list-item.selected {
  border-color: #9cc8af;
  background: var(--green-soft);
}
.agent-list-item > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 820;
}
.agent-list-item strong,
.agent-list-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-list-item strong { font-size: 13px; }
.agent-list-item small { margin-top: 4px; color: var(--muted); font-size: 13px; }
.agent-list-item em {
  color: var(--muted);
  font-style: normal;
  font-weight: 900;
}
.agent-list-item.custom-agent-item {
  padding-right: 38px;
}
.agent-delete-custom {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid #efd3cf;
  border-radius: 999px;
  background: #fffaf9;
  color: var(--red);
  font-style: normal;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}
.agent-delete-custom:hover {
  border-color: #df8f87;
  background: var(--red-soft);
}
.agent-workspace {
  display: block;
  min-width: 0;
  overflow: auto;
  padding: 26px 24px 40px;
}
.agent-empty-select,
.agent-workspace-card {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: min(420px, calc(100vh - 360px));
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}
.agent-empty-select {
  min-height: 430px;
  background: linear-gradient(180deg, rgba(246,255,252,.58), rgba(255,255,255,.62));
}
.agent-empty-select > span {
  font-size: 34px !important;
}
.agent-empty-select > strong {
  font-size: 24px !important;
}
.agent-empty-select > p {
  max-width: 520px !important;
  font-size: 16px !important;
}
.agent-workspace-form {
  display: grid;
  align-content: start;
  gap: 24px;
}
.agent-workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.agent-workspace-head strong {
  display: block;
  color: var(--text);
  font-size: 24px;
  font-weight: 840;
}
.agent-workspace-head p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}
.agent-workspace-head b {
  display: block;
  margin-top: 6px;
  color: var(--green);
  font-size: 16px;
  line-height: 1.55;
}
.agent-param-pills {
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 24px;
}
.agent-param-pills span,
.agent-tag-cloud span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 820;
  white-space: nowrap;
}
.agent-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}
.agent-form-grid label {
  display: grid;
  gap: 8px;
}
.agent-form-grid label > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 780;
}
.agent-form-grid input,
.agent-form-grid select,
.agent-form-grid textarea {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
}
.agent-form-grid textarea {
  min-height: 92px;
  padding: 14px 16px;
  line-height: 1.55;
  resize: vertical;
}
.agent-form-grid input:focus,
.agent-form-grid select:focus,
.agent-form-grid textarea:focus {
  border-color: #9cc8af;
  box-shadow: 0 0 0 3px rgba(16,163,127,.12);
}
.agent-wide-field {
  grid-column: 1 / -1;
}
.agent-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.agent-tag-cloud span {
  min-height: 32px;
  padding: 0 12px;
  background: #fbfbfa;
  font-size: 13px;
}
.agent-skill-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfffd;
}
.agent-skill-section > div:first-child {
  display: grid;
  gap: 4px;
}
.agent-skill-section-preview {
  margin-top: 10px;
  width: min(100%, 780px);
  text-align: left;
}
.agent-skill-section strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 840;
}
.agent-skill-section span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.agent-skill-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.agent-skill-preview-list,
.agent-skill-group {
  display: grid;
  gap: 10px;
}
.agent-skill-preview-list {
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}
.agent-skill-group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}
.agent-skill-group-title strong {
  font-size: 12px;
}
.agent-skill-group-title small {
  color: var(--muted);
  font-size: 11px;
}
.agent-skill-chip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 62px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.agent-skill-chip:has(input:checked) {
  border-color: #8ac8aa;
  background: var(--green-soft);
}
.agent-skill-chip input {
  margin-top: 3px;
  accent-color: var(--green);
}
.agent-skill-chip span,
.agent-skill-chip strong,
.agent-skill-chip small {
  display: block;
}
.agent-skill-chip small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.agent-skill-preview-chip {
  display: grid;
  gap: 3px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.agent-skill-preview-chip.selected {
  border-color: #8ac8aa;
  background: var(--green-soft);
}
.agent-skill-preview-chip strong,
.agent-skill-preview-chip small {
  display: block;
}
.agent-skill-preview-chip small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.agent-generated-view {
  display: grid;
  align-content: start;
  gap: 18px;
}
.agent-brief-box {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
  padding: 20px;
  border: 1px solid #b8ded2;
  border-radius: 14px;
  background: #f2fffb;
}
.agent-brief-box strong {
  color: var(--text);
  font-size: 20px;
  font-weight: 840;
}
.agent-brief-box p {
  margin: 0;
  color: #4a4e49;
  font-size: 16px;
  line-height: 1.65;
}
.agent-variant-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.agent-variant-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.agent-variant-card:hover,
.agent-variant-card:focus-visible,
.agent-variant-card.selected {
  border-color: #78bf9f;
  box-shadow: 0 14px 34px rgba(16, 163, 127, .13);
  outline: none;
  transform: translateY(-1px);
}
.agent-variant-card.selected {
  border-color: #9cc8af;
  background: linear-gradient(180deg, #f6fffc, #fff);
}
.agent-variant-card strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 840;
}
.agent-variant-card p {
  overflow: hidden;
  display: -webkit-box;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
}
.agent-variant-card button {
  justify-self: start;
  margin-top: auto;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 14px;
  font-weight: 840;
}
.agent-generated-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.agent-generated-notes span {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}
.agent-form-grid-compact {
  margin-top: 8px;
}
.agent-empty-select > span {
  color: var(--green);
  font-size: 24px;
}
.agent-empty-select > strong {
  color: var(--text);
  font-size: 17px;
}
.agent-empty-select > p {
  max-width: 440px;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}
.agent-workspace-card {
  place-items: stretch;
  align-content: start;
  padding: 22px;
  text-align: left;
}
.agent-workspace-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.agent-workspace-title > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font-weight: 840;
}
.agent-workspace-title strong,
.agent-workspace-title small {
  display: block;
}
.agent-workspace-title strong { color: var(--text); font-size: 18px; }
.agent-workspace-title small { margin-top: 3px; color: var(--muted); }
.agent-workspace-card p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}
.agent-goal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.agent-goal-row span {
  padding: 6px 9px;
  border: 1px solid #b8ded2;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 760;
}
.agent-workspace-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.agent-workspace-card dl > div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.agent-workspace-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}
.agent-workspace-card dd {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 820;
}
.agent-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 12px 18px;
  padding: 22px 24px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.96);
}
.agent-panel-actions .primary-action,
.agent-panel-actions .subtle-button,
.agent-panel-actions .danger-action {
  min-height: 54px;
  padding: 0 22px;
  font-size: 16px;
  font-weight: 840;
}
.primary-action.compact,
.danger-action.compact,
.subtle-button.compact {
  min-height: 54px;
  padding: 0 22px;
  font-size: 16px;
  font-weight: 840;
}
.primary-action.is-disabled {
  border-color: #d4d7d1;
  background: #8c918b;
  color: #fff;
}
.danger-action {
  border-color: #efd3cf;
  background: #fffaf9;
  color: var(--red);
}

.settings-panel {
  grid-column: 3;
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding: 0 8px 18px;
  border-width: 0 0 0 1px;
  background: #f3f3f0;
}
.settings-panel.collapsed { display: none; }
.panel-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 4px;
  background: rgba(243,243,240,.92);
  backdrop-filter: blur(16px);
}
.settings-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dadbd4;
  border-radius: 10px;
  background: #fff;
}
.sr-only,
.hidden-model-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}
.settings-section label,
.section-label {
  display: grid;
  gap: 6px;
  color: #666761;
  font-size: 13px;
  font-weight: 780;
}
.settings-section input,
.settings-section select,
.settings-section textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--text);
  outline: none;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 720;
}
.settings-section textarea {
  min-height: 84px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}
.settings-section input:focus,
.settings-section select:focus,
.settings-section textarea:focus {
  border-color: #8aa7c6;
  background: #fff;
}
.protocol-note,
.endpoint-note {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.protocol-note strong { color: var(--text); font-size: 13px; font-weight: 850; }
.protocol-note small { color: var(--muted); font-size: 12px; font-weight: 800; }
.model-fetch-help.error {
  border-color: #efb4af;
  background: var(--red-soft);
  color: var(--red);
}
.model-fetch-help.success {
  border-color: #b8ded2;
  background: var(--green-soft);
  color: var(--green);
}
.debug-api-banner {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #b8ded2;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  line-height: 1.35;
}
.debug-api-banner strong {
  color: var(--green);
  font-size: 13px;
}
.pool-login-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(16, 163, 127, .22);
  border-radius: 8px;
  background: #f6fffb;
}
.pool-login-status {
  display: grid;
  gap: 4px;
}
.pool-login-status span,
.pool-login-status small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
}
.pool-login-status strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}
.pool-login-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}
.pool-login-form button {
  width: 100%;
}
.pool-login-form .primary-action,
.pool-login-form .subtle-button {
  min-height: 38px;
}
.pool-login-form .subtle-button {
  grid-column: 1 / -1;
}
.connection-mode-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.connection-mode-group button {
  display: grid;
  min-height: 52px;
  justify-items: start;
  align-content: center;
  padding: 9px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--text);
  text-align: left;
}
.connection-mode-group button.selected {
  border-color: #9cc8af;
  background: var(--green-soft);
  color: var(--green);
}
.connection-mode-group strong { font-size: 13px; font-weight: 850; white-space: nowrap; }
.connection-mode-group span { color: var(--muted); font-size: 11px; font-weight: 760; }
.primary-action {
  min-height: 40px;
  gap: 8px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 850;
}
.status-line {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.4;
}
.local-save-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 10px;
  border: 1px solid #b8ded2;
  border-radius: 8px;
  background: var(--green-soft);
  color: #1d5f4f;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}
.local-save-note span:first-child {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  font-weight: 900;
}
.local-save-note strong {
  color: #0f3f35;
}
.section-copy {
  display: grid;
  gap: 6px;
}
.section-copy strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 880;
}
.section-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.32;
}
.model-filter span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.model-filter input {
  padding-left: 12px;
  background: #fbfbfa;
}
.model-filter {
  position: relative;
}
.model-filter::before {
  content: none;
}
.available-model-list {
  display: grid;
  max-height: 260px;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}
.available-model-item,
.empty-model-list {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  text-align: left;
}
.available-model-item {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 0;
  line-height: 1.25;
}
.available-model-item::before {
  content: none;
}
.available-model-item strong,
.available-model-item span,
.available-model-item small {
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.available-model-item.selected {
  border-color: #9cc8af;
  background: var(--green-soft);
}
.empty-model-list {
  display: grid;
  min-height: 60px;
  place-items: center;
  border-style: dashed;
  color: var(--muted);
  text-align: center;
}
.analysis-card {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}
.manual-text-model-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(16, 163, 127, .2);
  border-radius: 8px;
  background: #f6fffb;
}
.manual-text-model-panel.hidden,
.manual-text-model-panel .hidden {
  display: none !important;
}
.analysis-card > strong {
  color: #666761;
  font-size: 13px;
  font-weight: 880;
}
.inline-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  line-height: 1.3;
}
.inline-note span:first-child {
  color: var(--muted);
}
.generation-settings,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.generation-settings > label,
.generation-settings > .setting-summary-card {
  grid-column: 1 / -1;
}
.generation-settings .title-field {
  display: none;
}
.settings-grid {
  grid-column: 1 / -1;
  gap: 14px;
}
.advanced-generation-options {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}
.advanced-generation-options summary {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
  cursor: pointer;
}
.advanced-generation-options .settings-grid {
  margin-top: 10px;
}
.setting-summary-card {
  display: grid;
  gap: 6px;
  padding: 18px 16px;
  border: 1px solid #d7d8d2;
  border-radius: 12px;
  background: #fbfbfa;
}
.setting-summary-card strong {
  color: var(--text);
  font-size: 23px;
  font-weight: 900;
}
.setting-summary-card span {
  color: #666761;
  font-size: 16px;
  font-weight: 780;
}
.setting-summary-card small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 820;
  line-height: 1.35;
}
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
}
.check-row input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--green);
}
.reference-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.reference-thumb {
  overflow: hidden;
  display: grid;
  width: 108px;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  text-align: left;
}
.reference-thumb.active {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(16,163,127,.15);
}
.reference-thumb img {
  width: 100%;
  height: 96px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
}
.reference-thumb span,
.empty-reference {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-reference {
  width: 100%;
  padding: 18px 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: none;
  pointer-events: none;
}
body.studio-active .onboarding-overlay:not(.hidden) { display: block; }
.onboarding-click-catcher {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 12, .58);
}
.onboarding-spotlight {
  position: absolute;
  top: 72px;
  right: 8px;
  width: min(460px, calc(100vw - 40px));
  height: calc(100vh - 86px);
  border: 3px solid rgba(255,255,255,.98);
  border-radius: 24px;
  background: rgba(255,255,255,.08);
  box-shadow:
    0 0 0 8px rgba(16,163,127,.36),
    0 0 0 9999px rgba(10, 11, 12, .58),
    0 22px 80px rgba(0,0,0,.24);
}
.onboarding-overlay:has(.onboarding-spotlight[style*="display: block"]) .onboarding-click-catcher {
  background: transparent;
}
.guide-step-model .onboarding-spotlight {
  top: auto;
  right: 22px;
  bottom: 44px;
  width: min(405px, calc(100vw - 44px));
  height: 250px;
}
.guide-step-compose .onboarding-spotlight {
  left: 14px;
  right: auto;
  top: auto;
  bottom: 10px;
  width: min(1180px, calc(100vw - 430px));
  height: 290px;
  transform: none;
}
body:has(.app-shell:not(.settings-open)) .guide-step-compose .onboarding-spotlight {
  left: 50%;
  width: min(950px, calc(100vw - 80px));
  transform: translateX(-50%);
}
.onboarding-panel {
  position: absolute;
  left: 104px;
  top: 72px;
  z-index: 2;
  display: grid;
  width: min(630px, calc(100vw - 520px));
  min-width: 430px;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(17,17,17,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
  backdrop-filter: blur(22px);
  pointer-events: auto;
}
.guide-step-model .onboarding-panel {
  left: auto;
  right: 450px;
  top: auto;
  bottom: 180px;
  width: min(530px, calc(100vw - 520px));
  min-width: 430px;
}
.guide-step-compose .onboarding-panel {
  left: 24px;
  right: auto;
  top: auto;
  bottom: 338px;
  width: min(530px, calc(100vw - 56px));
  min-width: 0;
}
.onboarding-progress {
  display: flex;
  gap: 7px;
}
.onboarding-progress button {
  width: 100%;
  height: 5px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d7d8d2;
}
.onboarding-progress button.active { background: var(--green); }
.onboarding-copy {
  display: grid;
  gap: 8px;
}
.onboarding-copy span {
  color: var(--green);
  font-size: 12px;
  font-weight: 780;
}
.onboarding-copy strong {
  color: var(--text);
  font-size: 26px;
  line-height: 1.2;
}
.onboarding-copy p,
.onboarding-copy small {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}
.onboarding-copy small { font-weight: 760; }
.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.guide-bubble {
  position: absolute;
  left: 34px;
  bottom: 202px;
  z-index: 3;
  padding: 8px 11px;
  border: 1px solid #9cc8af;
  border-radius: 8px;
  background: #f2fffb;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}
.guide-bubble::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid #9cc8af;
  border-bottom: 1px solid #9cc8af;
  background: #f2fffb;
  transform: rotate(45deg);
}
.guide-bubble.hidden { display: none; }

.admin-auth-page,
.admin-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 16%, rgba(16, 163, 127, .16), transparent 32%),
    linear-gradient(135deg, #f7f7f4 0%, #eeeeea 48%, #f9fbf8 100%);
}
.admin-auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  gap: clamp(28px, 5vw, 86px);
  align-items: center;
  padding: clamp(28px, 5vw, 76px);
}
.admin-auth-hero {
  display: grid;
  max-width: 760px;
  gap: 28px;
}
.admin-auth-brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 12px;
  font-weight: 900;
}
.admin-kicker {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.admin-auth-hero h1,
.admin-console-hero h1 {
  max-width: 760px;
  margin: 0;
  color: #111;
  font-size: clamp(48px, 6.2vw, 104px);
  line-height: .94;
  font-weight: 920;
}
.admin-auth-hero p,
.admin-console-hero p {
  max-width: 660px;
  margin: 0;
  color: #4f504a;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.62;
}
.admin-auth-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.admin-auth-metrics span {
  display: inline-grid;
  gap: 4px;
  min-width: 148px;
  padding: 14px 16px;
  border: 1px solid rgba(17,17,17,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.admin-auth-metrics b {
  color: #111;
  font-size: 18px;
}
.admin-login-card,
.admin-card {
  border: 1px solid rgba(17,17,17,.1);
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 24px 70px rgba(17,17,17,.10);
  backdrop-filter: blur(18px);
}
.admin-login-card {
  display: grid;
  gap: 18px;
  padding: 32px;
}
.admin-login-card h2,
.admin-card h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 920;
}
.login-form {
  display: grid;
  gap: 14px;
}
.login-form label,
.admin-route-fields label,
.admin-inline-fields label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.login-form input,
.login-form button,
.admin-config-form input,
.admin-config-form textarea,
.admin-config-form select {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--text);
  padding: 10px 12px;
}
.login-form button,
.admin-primary-button {
  border-color: #111;
  background: #111;
  color: #fff;
  font-weight: 900;
}
.error {
  padding: 10px 12px;
  border: 1px solid #efb4af;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  font-weight: 820;
}
.admin-auth-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(17,17,17,.08);
  background: rgba(247,247,244,.82);
  backdrop-filter: blur(18px);
}
.admin-topbar nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-topbar a,
.admin-topbar button,
.admin-form-actions a {
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.76);
  color: #222;
  font-size: 13px;
  font-weight: 840;
}
.admin-topbar form { margin: 0; }
.admin-console {
  display: grid;
  gap: 24px;
  padding: clamp(24px, 4vw, 56px);
}
.admin-console-hero {
  display: grid;
  gap: 14px;
}
.admin-page .admin-console-hero h1 {
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.02;
}
.admin-save-toast {
  width: fit-content;
  padding: 11px 14px;
  border: 1px solid #9cc8af;
  border-radius: 8px;
  background: var(--green-soft);
  color: #0f6f5a;
  font-size: 13px;
  font-weight: 860;
}
.admin-config-form {
  display: grid;
  gap: 20px;
}
.admin-card {
  display: grid;
  gap: 20px;
  padding: 22px;
}
.admin-card-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}
.admin-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
}
.admin-inline-fields {
  display: grid;
  min-width: min(460px, 100%);
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
}
.admin-route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.admin-route-item {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfbfa;
}
.admin-route-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.admin-route-title strong {
  font-size: 18px;
  font-weight: 920;
}
.admin-route-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.admin-wide-field {
  grid-column: 1 / -1;
}
.admin-textarea-field {
  gap: 8px;
}
.admin-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.admin-field-head button {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: #1f5f50;
  font-size: 12px;
  font-weight: 880;
  cursor: pointer;
}
.admin-field-head button:hover {
  border-color: #9cc8af;
  background: var(--green-soft);
}
.admin-key-summary {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(17,17,17,.08);
  border-radius: 8px;
  background: #fff;
}
.admin-key-summary strong,
.admin-key-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.admin-key-summary div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-key-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(15, 111, 90, .16);
  border-radius: 7px;
  background: var(--green-soft);
  color: #123a31;
  font-size: 12px;
  font-weight: 850;
}
.admin-key-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.admin-key-chip b {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: rgba(17,17,17,.12);
  color: #555;
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}
.admin-key-chip:has(input:checked) {
  border-color: rgba(180, 45, 33, .35);
  background: var(--red-soft);
  color: var(--red);
  text-decoration: line-through;
}
.admin-key-chip:has(input:checked) b {
  background: rgba(180, 45, 33, .16);
  color: var(--red);
}
.admin-route-fields textarea,
.admin-model-textarea {
  resize: vertical;
  line-height: 1.5;
}
.admin-debug-panel,
.admin-model-filter-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfbfa;
}
.admin-debug-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.admin-debug-panel strong {
  display: block;
  font-size: 16px;
  font-weight: 920;
}
.admin-debug-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
  line-height: 1.55;
}
.admin-model-summary {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfbfa;
}
.admin-model-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-model-summary-head strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 920;
}
.admin-model-summary-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}
.admin-model-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-model-chip {
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid rgba(15, 111, 90, .18);
  border-radius: 7px;
  background: var(--green-soft);
  color: #123a31;
  font-size: 12px;
  font-weight: 850;
  overflow-wrap: anywhere;
}
.admin-provider-list {
  display: grid;
  gap: 10px;
}
.admin-provider-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 120px auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(17,17,17,.08);
  border-radius: 8px;
  background: #fff;
}
.admin-provider-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.admin-provider-row input,
.admin-provider-row select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--text);
  padding: 8px 10px;
}
.admin-provider-new {
  border-style: dashed;
  background: #fbfbfa;
}
.admin-delete-check {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(180, 45, 33, .22);
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red) !important;
  font-size: 12px;
  font-weight: 880;
  white-space: nowrap;
}
.admin-delete-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--red);
}
.admin-switch input {
  position: absolute;
  opacity: 0;
}
.admin-switch span {
  display: block;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #d8d8d2;
  position: relative;
}
.admin-switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s ease;
}
.admin-switch input:checked + span {
  background: var(--green);
}
.admin-switch input:checked + span::after {
  transform: translateX(20px);
}
.admin-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-check-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: #222;
  font-size: 13px;
  font-weight: 880;
  white-space: nowrap;
}
.admin-check-all input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}
.admin-primary-button {
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
}
.admin-section {
  scroll-margin-top: 90px;
}
.admin-section-nav {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.admin-tabs {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  border: 1px solid rgba(17,17,17,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 18px 44px rgba(17,17,17,.08);
  backdrop-filter: blur(18px);
}
.admin-tab {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  min-width: 138px;
  gap: 3px;
  padding: 11px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #62625b;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.admin-tab span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.admin-tab b {
  font-size: 14px;
  font-weight: 920;
}
.admin-tab::after {
  content: "";
  position: absolute;
  inset-inline: 14px;
  bottom: -10px;
  height: 3px;
  border-radius: 999px;
  background: transparent;
}
.admin-tab:hover {
  background: rgba(17,17,17,.045);
  color: #161616;
}
.admin-tab.is-active {
  border-color: rgba(17,17,17,.12);
  background: #111;
  color: #fff;
}
.admin-tab.is-active::after {
  background: var(--green);
}
.admin-tab-stage {
  display: grid;
  gap: 24px;
  min-height: 620px;
}
.admin-tab-panel {
  display: none;
}
.admin-tab-panel.is-active {
  display: grid;
  animation: adminPanelIn .16s ease-out;
}
@keyframes adminPanelIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.admin-stat-grid span {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}
.admin-stat-grid b {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}
.admin-stat-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.admin-stat-grid.compact span {
  min-height: 58px;
  padding: 10px;
}
.admin-stat-grid.compact b {
  font-size: 18px;
}
.admin-management-grid,
.admin-log-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.admin-single-grid {
  grid-template-columns: minmax(0, 520px);
}
.admin-mini-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
}
.admin-mini-form h3,
.admin-config-form h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 920;
}
.admin-help-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
  line-height: 1.65;
}
.admin-help-text code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: #333;
}
.pool-user-management {
  align-items: start;
}
.pool-user-list {
  align-content: start;
}
.pool-user-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.pool-user-meta {
  display: grid;
  align-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}
.admin-switch-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}
.admin-mini-form label,
.admin-config-form > label,
.admin-row-actions label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.admin-mini-form input,
.admin-mini-form textarea,
.admin-mini-form select,
.admin-row-actions input,
.admin-row-actions select,
.admin-row-actions button,
.admin-table input,
.admin-table select,
.admin-table button,
.admin-form-actions button {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font-weight: 760;
}
.admin-mini-form textarea {
  resize: vertical;
  line-height: 1.5;
}
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.admin-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-sync-table {
  min-width: 860px;
}
.admin-table th,
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(17,17,17,.08);
  text-align: left;
  vertical-align: top;
}
.admin-table th {
  background: #f3f3ef;
  color: #606059;
  font-size: 12px;
  font-weight: 920;
}
.admin-table td small,
.admin-token-cell small,
.admin-log-list span,
.admin-image-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.admin-token-cell {
  max-width: 190px;
  word-break: break-all;
}
.admin-error-text {
  color: var(--red) !important;
}
.admin-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ededeb;
  color: #555;
  font-size: 12px;
  font-weight: 900;
}
.admin-status-正常 {
  background: var(--green-soft);
  color: #0f6f5a;
}
.admin-status-限流 {
  background: #fff4d9;
  color: #8a5c00;
}
.admin-status-异常,
.admin-status-禁用 {
  background: var(--red-soft);
  color: var(--red);
}
.admin-row-actions {
  display: grid;
  grid-template-columns: 88px 118px 76px minmax(140px, 1fr);
  gap: 8px;
  min-width: 520px;
}
.admin-row-actions button {
  grid-column: span 2;
  background: #111;
  color: #fff;
}
.admin-danger-button {
  border-color: #c73c32 !important;
  background: #c73c32 !important;
  color: #fff !important;
  font-weight: 900 !important;
}
.admin-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfbfa;
  font-size: 13px;
  font-weight: 780;
}
.admin-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.admin-image-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
}
.admin-image-card label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.admin-image-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: #ecece8;
}
.admin-image-card p {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: #444;
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.admin-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.admin-preset-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
}
.admin-preset-card label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.admin-preset-card img,
.admin-preset-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: #ecece8;
}
.admin-preset-card img {
  object-fit: cover;
}
.admin-preset-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}
.admin-preset-card p {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: #444;
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.admin-log-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
}
.admin-log-list > div:not(.admin-empty) {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
}
.admin-log-list code {
  overflow: hidden;
  color: #65655d;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .admin-auth-shell {
    grid-template-columns: 1fr;
  }
  .admin-route-grid,
  .admin-inline-fields,
  .admin-management-grid,
  .admin-log-grid,
  .pool-user-row {
    grid-template-columns: 1fr;
  }
  .admin-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-card-head,
  .admin-topbar {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (min-width: 1181px) {
  body.studio-active {
    --settings-panel-width: 350px;
    --left-sidebar-width: 280px;
  }

  .app-shell {
    --settings-panel-width: 350px;
  }

  .composer {
    width: min(930px, calc(100% - 36px));
  }

  .settings-panel {
    gap: 8px;
    padding: 0 8px 18px;
  }

  .panel-header {
    min-height: 56px;
    padding: 8px 0 4px;
  }

  .panel-header strong {
    font-size: 14px;
    font-weight: 780;
  }

  .panel-header span {
    font-size: 12px;
    font-weight: 650;
  }

  .settings-section {
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
  }

  .settings-section label,
  .section-label {
    gap: 6px;
    font-size: 13px;
    font-weight: 760;
  }

  .settings-section input,
  .settings-section select,
  .settings-section textarea {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 720;
  }

  .settings-section textarea {
    min-height: 84px;
    padding: 10px 12px;
    line-height: 1.45;
  }

  .protocol-note,
  .endpoint-note {
    gap: 5px;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 620;
  }

  .protocol-note strong {
    font-size: 13px;
    font-weight: 820;
  }

  .protocol-note small {
    font-size: 12px;
    font-weight: 720;
  }

  .connection-mode-group {
    gap: 8px;
  }

  .connection-mode-group button {
    min-height: 52px;
    padding: 9px 8px;
    border-radius: 8px;
  }

  .connection-mode-group strong {
    font-size: 13px;
    font-weight: 820;
  }

  .connection-mode-group span {
    font-size: 11px;
    font-weight: 700;
  }

  .primary-action {
    min-height: 40px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 820;
  }

  .status-line,
  .local-save-note,
  .inline-note {
    font-size: 12px;
    font-weight: 720;
  }

  .local-save-note {
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
  }

  .local-save-note span:first-child {
    width: 18px;
    height: 18px;
  }

  .section-copy strong {
    font-size: 14px;
    font-weight: 820;
  }

  .section-copy span {
    font-size: 12px;
    font-weight: 650;
  }

  .model-filter::before {
    bottom: 10px;
    font-size: 16px;
  }

  .available-model-list {
    max-height: 260px;
    gap: 8px;
  }

  .available-model-item,
  .empty-model-list {
    min-height: 74px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 720;
  }

  .analysis-card {
    gap: 10px;
  }

  .analysis-card > strong {
    font-size: 13px;
    font-weight: 820;
  }

  .settings-grid {
    gap: 8px;
  }

  .advanced-generation-options {
    gap: 8px;
  }

  .advanced-generation-options summary {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .setting-summary-card {
    gap: 4px;
    padding: 11px 12px;
    border-radius: 8px;
  }

  .setting-summary-card strong {
    font-size: 18px;
    font-weight: 860;
  }

  .setting-summary-card span,
  .setting-summary-card small {
    font-size: 12px;
    font-weight: 700;
  }

  .reference-list {
    gap: 8px;
  }

  .reference-thumb {
    width: 92px;
    padding: 4px;
    border-radius: 8px;
  }

  .reference-thumb img {
    height: 78px;
    border-radius: 7px;
  }

  .onboarding-spotlight {
    top: 58px;
    right: 8px;
    width: calc(var(--settings-panel-width) - 16px);
    height: calc(100vh - 72px);
    border-radius: 22px;
  }

  .onboarding-panel {
    left: auto;
    right: calc(var(--settings-panel-width) + 14px);
    top: 58px;
    width: 420px;
    min-width: 0;
    gap: 12px;
    padding: 18px;
    border-radius: 10px;
  }

  .onboarding-copy strong {
    font-size: 23px;
  }

  .onboarding-copy p,
  .onboarding-copy small {
    font-size: 13px;
    line-height: 1.55;
  }

  .onboarding-actions .primary-action,
  .onboarding-actions .subtle-button {
    min-height: 40px;
    padding: 0 14px;
    font-size: 13px;
  }
}

@media (max-width: 1180px) {
  .home-hero {
    background-position: 58% center;
  }
  .home-hero h1 {
    font-size: 88px;
  }
  .home-analysis-showcase {
    grid-template-columns: 1fr;
  }
  .home-agent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-insight {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .app-shell {
    --left-sidebar-width: 240px;
    --right-column: 0px;
    grid-template-columns: var(--left-column) minmax(0, 1fr);
  }
  .settings-panel {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 20;
    width: min(360px, 92vw);
    box-shadow: -18px 0 36px rgba(21,24,20,.16);
  }
  .onboarding-panel { right: min(380px, 32vw); }
}

@media (max-width: 780px) {
  .home-hero {
    min-height: 86svh;
    justify-content: flex-end;
    background-position: 58% center;
    padding: 92px 18px 48px;
  }
  .home-hero-logo { display: none; }
  .home-nav {
    min-height: 64px;
    padding: 12px 16px;
    gap: 8px;
  }
  .home-nav-links { display: none; }
  .home-brand strong {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .home-nav-action {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }
  .home-admin-link {
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }
  .home-hero h1 {
    max-width: 340px;
    font-size: 64px;
    letter-spacing: 0;
    line-height: 1.02;
  }

  .composer {
    width: calc(100% - 20px);
    bottom: 10px;
  }

  .composer-main {
    grid-template-columns: 40px minmax(0, 1fr) 42px 40px;
    align-items: center;
    gap: 8px;
    padding: 8px;
  }

  .upload-button {
    grid-column: 1;
    grid-row: 1;
  }

  .preset-button {
    grid-column: 2 / -1;
    grid-row: 1;
    justify-content: center;
  }

  .composer-main textarea {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 58px;
    min-height: 58px;
    padding: 11px 12px;
  }

  .quick-config-button {
    grid-column: 1 / 3;
    grid-row: 3;
    max-width: none;
    justify-content: center;
  }

  .send-button {
    grid-column: 3;
    grid-row: 3;
  }

  .clear-prompt-button {
    grid-column: 4;
    grid-row: 3;
  }

  .home-hero-copy p {
    font-size: 17px;
    overflow-wrap: anywhere;
  }
  .home-metric-row {
    display: grid;
    width: calc(100vw - 36px);
    max-width: calc(100vw - 36px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 24px;
  }
  .home-metric {
    min-width: 0;
    overflow: hidden;
    padding: 10px 11px;
  }
  .home-metric strong { font-size: 17px; }
  .home-metric span { font-size: 11px; }
  .home-analysis-showcase,
  .home-agent-section,
  .home-insight,
  .home-creation-section {
    width: calc(100% - 36px);
    padding: 58px 0;
  }
  .home-browser-body {
    grid-template-columns: 74px minmax(0, 1fr);
  }
  .home-browser-body aside:last-child {
    display: none;
  }
  .home-showcase-copy h2,
  .home-section-copy h2,
  .home-insight h2 {
    font-size: 42px;
  }
  .home-agent-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
    height: auto;
  }
  .sidebar {
    display: none;
  }
  .workspace {
    grid-column: 1;
    min-height: 100vh;
  }
  .topbar {
    min-height: 44px;
    padding: 6px 10px;
  }
  .status-pill,
  .current-model {
    display: none;
  }
  .canvas {
    padding: 12px 12px 136px;
    min-height: 680px;
  }
  .composer {
    bottom: 10px;
    width: calc(100% - 20px);
  }
  .agent-modal {
    padding: 12px;
    align-items: end;
  }
  .agent-panel {
    width: 100%;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }
  .prompt-analysis-card {
    max-height: 58vh;
    overflow: auto;
  }
  .agent-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .agent-list {
    grid-template-columns: 1fr 1fr;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .agent-workspace-head {
    display: grid;
  }
  .agent-param-pills {
    justify-content: flex-start;
    padding-top: 0;
  }
  .agent-form-grid {
    grid-template-columns: 1fr;
  }
  .agent-workspace-card dl {
    grid-template-columns: 1fr;
  }
  .guide-step-model .onboarding-spotlight,
  .guide-step-compose .onboarding-spotlight {
    left: 10px;
    right: 10px;
    width: auto;
    transform: none;
  }
  .guide-step-model .onboarding-panel,
  .guide-step-compose .onboarding-panel {
    left: 14px;
    right: 14px;
    top: 82px;
  }
  .guide-bubble {
    left: 28px;
    bottom: 164px;
  }
  .agent-quickbar {
    align-items: center;
    flex-direction: row;
}
.composer-reference-list {
  display: grid;
  gap: 8px;
}
.composer-reference-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 24px 36px;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 24px rgba(17,17,17,.08), inset 0 1px rgba(255,255,255,.72);
}
.composer-reference-item img {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-soft);
}
.composer-reference-item strong,
.composer-reference-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-reference-item strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 880;
}
.composer-reference-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}
.composer-reference-item .reference-ok {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid var(--green);
  border-radius: 999px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}
.composer-reference-item button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 22px;
}
.composer-main {
    grid-template-columns: 36px minmax(56px, auto) minmax(0, 1fr) 36px 36px;
  }
  .quick-config-button {
    grid-column: 1 / -1;
    justify-self: end;
    min-height: 34px;
  }
  .quick-config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .preset-grid {
    grid-template-columns: 1fr;
  }
  .preset-card {
    min-height: 144px;
  }
  .preset-button {
    max-width: 70px;
    overflow: hidden;
    padding: 0 10px;
    white-space: nowrap;
  }
  .composer-meta {
    overflow-x: auto;
    justify-content: flex-start;
  }
  .settings-panel {
    grid-column: 1;
    position: static;
    width: auto;
    box-shadow: none;
    border-width: 1px 0 0;
  }
  .compact-grid {
    grid-template-columns: 1fr;
  }
  .onboarding-panel {
    right: 14px;
    bottom: 14px;
    top: auto;
  }
  .onboarding-spotlight {
    display: none;
  }
}

@media (max-width: 520px) {
  .home-nav-action { display: none; }
  .home-admin-link {
    width: 38px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    text-indent: -999px;
  }
  .home-hero h1 {
    max-width: 300px;
    font-size: 56px;
  }
  .home-hero-actions {
    align-items: stretch;
  }
  .home-primary,
  .home-secondary {
    justify-content: center;
  }
  .home-browser-body {
    grid-template-columns: 1fr;
    min-height: 330px;
  }
  .home-browser-body aside {
    display: none;
  }
  .mini-agent-panel {
    grid-template-columns: 1fr;
  }
  .home-showcase-copy h2,
  .home-section-copy h2,
  .home-insight h2 {
    font-size: 36px;
  }
}

@media (min-width: 1181px) {
  .workspace,
  .settings-panel,
  .composer {
    font-size: 13px;
  }

  .composer {
    bottom: 14px;
    width: min(930px, calc(100% - 36px));
    gap: 5px;
  }

  .agent-mode-strip {
    min-height: 50px;
    padding: 8px 12px;
    border-radius: 14px;
  }

  .agent-mode-strip strong {
    font-size: 12px;
  }

  .agent-mode-strip span {
    font-size: 11px;
  }

  .agent-mode-toggle {
    min-width: 58px;
    width: auto;
    height: 30px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255,255,255,.78);
    color: var(--text);
    font-size: 12px;
    font-weight: 820;
  }

  .agent-mode-toggle.active {
    border-color: #9cc8af;
    background: var(--green);
    color: #fff;
  }

  .agent-mode-toggle::after,
  .agent-mode-toggle.active::after {
    content: none;
  }

  .agent-mode-toggle {
    position: relative;
    display: inline-flex;
    width: 62px;
    min-width: 62px;
    height: 36px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(220,220,216,.9);
    border-radius: 999px;
    background: rgba(236,236,233,.86);
    color: #4b4d48;
    font-size: 0;
    font-weight: 820;
    box-shadow: inset 0 1px rgba(255,255,255,.68);
  }

  .agent-mode-toggle::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 6px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 2px 8px rgba(17,17,17,.12);
    transition: transform .16s ease, background .16s ease;
  }

  .agent-mode-toggle.active {
    justify-content: center;
    padding: 0;
    border-color: #9cc8af;
    background: var(--green);
    color: #fff;
  }

  .agent-mode-toggle.active::before {
    background: #fff;
    transform: translateX(24px);
  }

  .composer.agent-collapsed:not(.agent-applied) .agent-quickbar,
  .composer.agent-mode-enabled .agent-quickbar {
    display: flex;
  }

  .composer.agent-collapsed .agent-entry-button,
  .composer.agent-collapsed #expandAdvanced {
    display: inline-flex;
  }

  .agent-quickbar {
    overflow: visible;
  }

  .agent-entry-button {
    flex-basis: 210px;
    min-width: 210px;
  }

  .agent-quick-list {
    flex: 1 1 auto;
    min-width: 0;
  }

  .composer.agent-collapsed .agent-quick-list {
    display: none;
  }

  .composer.agent-collapsed .agent-status-bubble {
    margin-left: auto;
  }

  .composer.agent-mode-enabled .agent-quickbar {
    display: flex;
  }

  .composer-main {
    grid-template-columns: 34px minmax(68px, auto) minmax(96px, auto) minmax(240px, 1fr) minmax(104px, max-content) 38px 34px;
    gap: 6px;
    min-height: 52px;
    padding: 6px;
    border-radius: 14px;
  }

  .upload-button,
  .preset-button,
  .prompt-optimize-button,
  .quick-config-button,
  .send-button,
  .clear-prompt-button {
    min-height: 34px;
    border-radius: 10px;
    font-size: 12px;
  }

  .upload-button,
  .send-button,
  .clear-prompt-button {
    width: 34px;
  }

  .preset-button,
  .prompt-optimize-button,
  .quick-config-button {
    padding: 0 11px;
  }

  .quick-config-button {
    max-width: 136px;
  }

  .composer-main textarea {
    height: 40px;
    min-height: 40px;
    max-height: 96px;
    padding: 10px 8px;
    font-size: 13px;
    line-height: 1.45;
  }

  .composer-main:focus-within {
    border-color: #9cc8af;
    background: rgba(255,255,255,.92);
    box-shadow: 0 18px 44px rgba(17,17,17,.14), 0 0 0 3px rgba(16,163,127,.12);
  }

  .composer-meta {
    min-height: 20px;
    font-size: 10px;
  }

  .composer-meta > span,
  .composer-auto-toggle {
    min-height: 20px;
    padding: 0 7px;
  }

  .composer-tools button {
    min-height: 28px;
    font-size: 11px;
  }

  .settings-panel {
    font-size: 12px;
  }

  .settings-section label,
  .section-label,
  .advanced-generation-options summary {
    font-size: 12px;
  }

  .settings-section input,
  .settings-section select,
  .settings-section textarea {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

.composer.has-prompt .composer-main,
.composer.agent-applied .composer-main,
.composer.agent-mode-enabled .composer-main {
  grid-template-columns: 38px minmax(84px, auto) minmax(104px, auto) minmax(0, 1fr) minmax(126px, max-content) 40px 40px;
  grid-auto-rows: auto;
  align-items: center;
}

.composer.has-prompt .composer-main textarea,
.composer.agent-applied .composer-main textarea,
.composer.agent-mode-enabled .composer-main textarea {
  grid-column: 1 / -1;
  grid-row: 2;
  height: clamp(86px, 18vh, 150px);
  min-height: 86px;
  max-height: 190px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fbfbfa;
  box-shadow: inset 0 0 0 1px rgba(220,220,216,.72);
  line-height: 1.58;
}

.composer.agent-applied .composer-main textarea {
  height: clamp(120px, 24vh, 180px);
  min-height: 120px;
}

.agent-modal {
  padding: 22px;
}

.agent-panel {
  width: min(1120px, calc(100vw - 44px));
  height: min(800px, calc(100vh - 64px));
}

.agent-panel-head {
  padding: 16px 18px;
}

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

.agent-list {
  gap: 8px;
  padding: 14px;
}

.agent-list-item {
  min-height: 58px;
  padding: 10px;
  border-radius: 10px;
}

.agent-workspace {
  padding: 18px 18px 28px;
}

.agent-workspace-form {
  gap: 18px;
}

.agent-workspace-head strong {
  font-size: 20px;
}

.agent-workspace-head p,
.agent-workspace-head b {
  font-size: 14px;
}

.agent-panel-actions {
  padding: 12px 18px;
}

@media (max-width: 900px) {
  .square-hero-inline {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-top: 42px;
  }
  .square-hero-inline h2 {
    font-size: 54px;
  }
  .square-register-card {
    min-width: 0;
  }
  .square-refresh-button {
    justify-self: start;
    margin-top: 0;
  }
  .square-tabs,
  .square-grid,
  .square-status,
  .square-topbar-inline,
  .square-hero-inline {
    width: min(100% - 24px, 1336px);
  }

  .preset-library-page {
    padding: 16px 12px 32px;
  }
  .preset-library-topbar {
    flex-wrap: wrap;
    margin: -16px -12px 18px;
    padding: 10px 12px;
  }
  .preset-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .preset-grid {
    grid-template-columns: 1fr;
  }
  .preset-card.has-image {
    grid-template-rows: 180px auto auto minmax(0, 1fr) auto;
  }
  .composer.has-prompt .composer-main,
  .composer.agent-applied .composer-main,
  .composer.agent-mode-enabled .composer-main {
    grid-template-columns: 40px minmax(0, 1fr) 42px 40px;
  }

  .composer.has-prompt .preset-button,
  .composer.agent-applied .preset-button,
  .composer.agent-mode-enabled .preset-button {
    grid-column: 2 / -1;
  }

  .composer.has-prompt .quick-config-button,
  .composer.agent-applied .quick-config-button,
  .composer.agent-mode-enabled .quick-config-button {
    grid-column: 1 / 3;
    grid-row: 3;
    max-width: none;
  }

  .composer.has-prompt .send-button,
  .composer.agent-applied .send-button,
  .composer.agent-mode-enabled .send-button {
    grid-column: 3;
    grid-row: 3;
  }

  .composer.has-prompt .clear-prompt-button,
  .composer.agent-applied .clear-prompt-button,
  .composer.agent-mode-enabled .clear-prompt-button {
    grid-column: 4;
    grid-row: 3;
  }
}

/* Composer polish: keep the bottom creator bar compact even with references or config open. */
.composer {
  isolation: isolate;
}

.composer-main {
  grid-template-columns: 40px minmax(74px, max-content) minmax(104px, max-content) minmax(180px, 1fr) minmax(124px, max-content) 42px 36px;
}

.upload-button,
.send-button,
.clear-prompt-button {
  aspect-ratio: 1;
  flex: 0 0 auto;
}

.upload-button {
  border-color: #a7d9ca;
  background: linear-gradient(180deg, #f1fffb, #dff8ef);
  box-shadow: inset 0 1px rgba(255,255,255,.78);
  font-size: 18px;
}

.preset-button,
.prompt-optimize-button {
  min-width: 76px;
  justify-content: center;
}

.quick-config-button {
  justify-content: center;
  min-width: 126px;
}

.composer.has-prompt .composer-main,
.composer.agent-applied .composer-main,
.composer.agent-mode-enabled .composer-main {
  grid-template-columns: 40px minmax(74px, max-content) minmax(104px, max-content) minmax(180px, 1fr) minmax(124px, max-content) 42px 36px;
}

.composer.has-prompt .composer-main textarea,
.composer.agent-applied .composer-main textarea,
.composer.agent-mode-enabled .composer-main textarea {
  grid-column: 4;
  grid-row: 1;
  height: 44px;
  min-height: 44px;
  max-height: 88px;
  padding: 12px 10px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  line-height: 1.45;
}

.composer.agent-applied .composer-main textarea {
  height: 48px;
  min-height: 48px;
}

.composer.quick-config-open .quick-config-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 8;
  max-height: min(230px, calc(100vh - 260px));
  overflow: auto;
}

.quick-config-panel {
  gap: 12px;
  padding: 14px;
  border-radius: 15px;
}

.quick-config-grid {
  grid-template-columns: repeat(6, minmax(92px, 1fr));
}

.quick-config-grid input,
.quick-config-grid select {
  min-height: 40px;
}

.composer-reference-list {
  z-index: 7;
  display: flex;
  width: 100%;
  gap: 8px;
  overflow-x: auto;
  min-height: 58px;
  padding: 6px 8px;
  border: 1px solid rgba(184,222,210,.78);
  border-radius: 13px;
  background: rgba(255,255,255,.76);
  box-shadow: inset 0 1px rgba(255,255,255,.72);
  backdrop-filter: blur(16px) saturate(1.12);
  pointer-events: auto;
}

.composer-reference-item {
  display: grid;
  flex: 0 0 min(310px, calc(100vw - 72px));
  grid-template-columns: 40px minmax(0, 1fr) 18px 30px;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 7px;
  border: 1px solid rgba(210,214,207,.98);
  border-radius: 11px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 18px rgba(17,17,17,.08), inset 0 1px rgba(255,255,255,.8);
}

.composer-reference-item img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface-soft);
}

.composer-reference-item strong {
  font-size: 12px;
  line-height: 1.1;
  color: var(--text);
  font-weight: 880;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-reference-item span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-reference-item .reference-ok {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-width: 1.5px;
  border-style: solid;
  border-color: var(--green);
  border-radius: 999px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
}

.composer-reference-item button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7f8f5;
  color: #60665f;
  font-size: 17px;
}
.composer-reference-item button:hover {
  border-color: #cfd4ca;
  background: #eef2ec;
  color: var(--text);
}

.composer-reference-list:not(.hidden) + .composer-tools {
  margin-top: 2px;
}

/* Composer layout: keep the writing row focused on upload + prompt, with actions below. */
.composer-main,
.composer.has-prompt .composer-main,
.composer.agent-applied .composer-main,
.composer.agent-mode-enabled .composer-main {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  padding: 10px;
}

.composer-main textarea,
.composer.has-prompt .composer-main textarea,
.composer.agent-applied .composer-main textarea,
.composer.agent-mode-enabled .composer-main textarea {
  grid-column: 2;
  grid-row: 1;
  height: clamp(86px, 16vh, 142px);
  min-height: 86px;
  max-height: 220px;
  padding: 13px 14px;
  border-radius: 12px;
  background: #fbfbfa;
  box-shadow: inset 0 0 0 1px rgba(220,220,216,.72);
  line-height: 1.58;
  resize: vertical;
}

.upload-button {
  align-self: start;
}

.composer-actionbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 4px;
}

.composer-actionbar .preset-button,
.composer-actionbar .prompt-optimize-button,
.composer-actionbar .quick-config-button {
  min-height: 36px;
}

.composer-actionbar .send-button,
.composer-actionbar .clear-prompt-button {
  width: 38px;
  min-height: 38px;
}

@media (max-width: 900px) {
  .composer-main,
  .composer.has-prompt .composer-main,
  .composer.agent-applied .composer-main,
  .composer.agent-mode-enabled .composer-main {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .composer.has-prompt .composer-main textarea,
  .composer.agent-applied .composer-main textarea,
  .composer.agent-mode-enabled .composer-main textarea,
  .composer-main textarea {
    grid-column: 2;
    grid-row: 1;
    min-height: 92px;
    height: 92px;
    border-radius: 12px;
    background: #fbfbfa;
    box-shadow: inset 0 0 0 1px rgba(220,220,216,.72);
  }

  .composer-actionbar {
    justify-content: flex-start;
  }

  .composer-actionbar .quick-config-button {
    max-width: none;
  }

  .composer.quick-config-open .quick-config-panel {
    max-height: min(360px, calc(100vh - 210px));
  }

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

  .composer-reference-list {
    min-height: 54px;
    padding: 5px 6px;
  }
}

.research-action,
.research-secondary {
  border-color: rgba(0, 123, 114, .28);
  background: rgba(232, 250, 244, .88);
  color: #00665f;
}

.research-workbench {
  display: none;
  width: 100vw;
  height: 100vh;
  min-height: 720px;
  overflow: hidden;
  padding: 10px;
  background:
    radial-gradient(circle at 10% 8%, rgba(16, 163, 127, .12), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(17, 17, 17, .055), transparent 32%),
    linear-gradient(180deg, #f7f7f4, #f2f2ef);
  color: var(--text);
}

body.research-active .research-workbench {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.research-topbar {
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.research-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid rgba(0, 123, 114, .18);
  border-radius: 12px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 12px 30px rgba(16,22,21,.08), inset 0 1px rgba(255,255,255,.72);
  backdrop-filter: blur(14px) saturate(1.08);
}

.research-head-nav,
.research-head-actions {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.research-head-nav {
  justify-content: flex-start;
}

.research-head-main {
  min-width: 0;
  text-align: center;
}

.research-head h2 {
  margin: 1px 0 2px;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.05;
  letter-spacing: 0;
}

.research-head p {
  max-width: 880px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-head .home-kicker {
  margin-bottom: 0;
  font-size: 10px;
}

.research-head-actions {
  justify-content: flex-end;
}

.research-layout {
  display: grid;
  grid-template-columns: minmax(310px, 22fr) minmax(620px, 58fr) minmax(290px, 20fr);
  gap: 12px;
  min-height: 0;
  height: 100%;
  width: 100%;
}

.research-workbench.left-collapsed .research-layout {
  grid-template-columns: minmax(0, 1fr) minmax(290px, 320px);
}

.research-workbench.right-collapsed .research-layout {
  grid-template-columns: minmax(310px, 340px) minmax(0, 1fr);
}

.research-workbench.left-collapsed.right-collapsed .research-layout {
  grid-template-columns: minmax(0, 1fr);
}

.research-workbench.left-collapsed .research-layout > .research-panel:first-child,
.research-workbench.right-collapsed .research-layout > .research-tools {
  display: none;
}

.research-panel,
.research-canvas-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.06);
}

.research-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.research-brand {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 8px;
}

.research-brand > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #b8ded2;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.research-brand strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1.05;
}

.research-brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.research-brand button,
.research-toolbar-right button,
.research-toolbar-right select,
.research-node-head select,
.research-node-head button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.research-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 8px 22px rgba(17,17,17,.045);
}

.research-node-factory {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.research-node-factory button {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.research-node-factory button:last-child {
  grid-column: span 1;
}

.research-paper-drop {
  display: grid;
  min-height: 118px;
  place-items: center;
  gap: 5px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 22%, rgba(16, 163, 127, .12), transparent 34%),
    linear-gradient(180deg, #fff, #f6fffb);
  color: var(--text);
  cursor: pointer;
}

.research-paper-drop input {
  display: none;
}

.research-paper-drop b {
  color: var(--green);
  font-size: 11px;
  letter-spacing: 1.6px;
}

.research-paper-drop strong {
  font-size: 17px;
}

.research-paper-drop span {
  color: var(--muted);
  font-size: 12px;
}

.research-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-weight: 900;
}

.research-section-title strong {
  min-width: 0;
  flex: 1;
}

.research-section-title em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}

.research-section-title span {
  display: grid;
  width: 30px;
  height: 28px;
  place-items: center;
  border: 1px solid #b8ded2;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
}

.research-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.research-field input,
.research-field select,
.research-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  color: var(--text);
  padding: 10px 11px;
  outline: none;
  font: inherit;
  font-size: 12px;
}

.research-field textarea {
  min-height: 126px;
  resize: vertical;
  line-height: 1.55;
}

#researchProjectContext {
  min-height: 92px;
}

.research-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.research-button-row,
.research-control-upload {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.research-button-row button,
.research-tool-grid button,
.research-prompt-repo button,
.research-primary-button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.86);
  color: var(--text);
  font-weight: 850;
}

.research-primary-button,
.research-button-row button:first-child {
  border-color: #0b8f72;
  background: linear-gradient(180deg, #14b88f, #0b8f72);
  color: #fff;
}

.research-canvas-card {
  overflow: hidden;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.research-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.82);
}

.research-toolbar-left,
.research-toolbar-right {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.research-toolbar-left {
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.research-toolbar-right {
  justify-content: flex-end;
  overflow-x: auto;
}

.research-icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 900;
}

.research-icon-button.active {
  background: var(--green);
  color: #fff;
}

.research-toolbar-right select {
  min-width: 104px;
  padding: 0 10px;
}

.research-toolbar-right button {
  padding: 0 14px;
  white-space: nowrap;
}

.research-toolbar-right .research-generate-button,
.research-toolbar-right .research-save-button {
  border-color: #0b8f72;
  background: linear-gradient(180deg, #14b88f, #0b8f72);
  color: #fff;
}

.research-canvas {
  position: relative;
  height: auto;
  min-height: 0;
  overflow: hidden;
  background: #f7f7f5;
  cursor: default;
  touch-action: none;
}

.research-canvas.is-panning {
  cursor: grab;
}

.research-canvas.is-panning.dragging {
  cursor: grabbing;
}

.research-stage {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.research-grid {
  position: absolute;
  inset: -2400px;
  background-image:
    linear-gradient(rgba(17, 17, 17, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, .055) 1px, transparent 1px),
    linear-gradient(rgba(16, 163, 127, .11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 163, 127, .11) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 144px 144px, 144px 144px;
}

.research-links {
  position: absolute;
  left: 0;
  top: 0;
  width: 1180px;
  height: 820px;
  overflow: visible;
  pointer-events: none;
}

.research-links path {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
}

.research-links path::after {
  content: "";
}

.research-node {
  position: absolute;
  min-width: 240px;
  max-width: 720px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
  padding: 14px 14px 42px;
  cursor: grab;
  user-select: none;
}

.research-node.selected {
  border-color: #9cc8af;
  box-shadow: 0 16px 36px rgba(16, 163, 127, .14), 0 0 0 2px rgba(16, 163, 127, .12);
}

.research-node.dragging {
  cursor: grabbing;
}

.research-node p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.research-node-prompt {
  width: 340px;
}

.research-node-output {
  width: 390px;
}

.research-node-diagram {
  width: 460px;
}

.research-node-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.research-node-head strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.research-node-head small {
  display: block;
  margin-top: 2px;
  color: var(--muted-soft);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .8px;
}

.research-node-head select {
  min-height: 28px;
  max-width: 120px;
}

.research-node-head button {
  min-height: 28px;
  width: 28px;
  color: #ce5570;
}

.research-node textarea {
  width: 100%;
  min-height: 96px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  resize: vertical;
}

.research-node .research-primary-button {
  width: 100%;
}

.research-node-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.research-node-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.research-node-grid input,
.research-node-grid select {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
}

.research-generated-preview {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  height: 210px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 18% 22%, rgba(16, 163, 127, .16), transparent 24%),
    radial-gradient(circle at 70% 20%, rgba(17, 17, 17, .08), transparent 28%),
    linear-gradient(135deg, #fff, #e7f8f2 48%, #f7f7f5);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.72);
}

.research-generated-preview.generated {
  border-color: #9cc8af;
  background:
    linear-gradient(90deg, rgba(16, 163, 127, .14) 1px, transparent 1px),
    linear-gradient(rgba(16, 163, 127, .14) 1px, transparent 1px),
    radial-gradient(circle at 30% 24%, rgba(16, 163, 127, .18), transparent 24%),
    linear-gradient(135deg, #fff, #f4fbf7 48%, #e8f8f2);
  background-size: 18px 18px, 18px 18px, auto, auto;
  color: var(--green);
}

.research-generated-preview strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 920;
}

.research-generated-preview span {
  max-width: 82%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
  text-align: center;
}

.research-diagram-preview {
  display: grid;
  min-height: 260px;
  max-height: 420px;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0, 123, 114, .06) 1px, transparent 1px),
    linear-gradient(rgba(0, 123, 114, .06) 1px, transparent 1px),
    #fbfdfb;
  background-size: 18px 18px;
  color: var(--muted);
  padding: 12px;
}

.research-diagram-preview.loading {
  color: var(--green);
  font-weight: 850;
}

.research-diagram-preview svg {
  display: block;
  max-width: 100%;
  height: auto;
  min-width: 360px;
}

.preview-b {
  background:
    radial-gradient(circle at 76% 20%, rgba(16, 163, 127, .18), transparent 22%),
    radial-gradient(circle at 22% 68%, rgba(17, 17, 17, .07), transparent 26%),
    linear-gradient(135deg, #fff, #f3f3f0 52%, #e7f8f2);
}

.research-port {
  position: absolute;
  display: grid;
  min-width: 28px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
}

.research-port.in {
  left: 14px;
  bottom: 12px;
}

.research-port.out {
  right: 14px;
  bottom: 12px;
}

.research-resize-handle {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 4px 0 6px;
  background:
    linear-gradient(135deg, transparent 0 48%, rgba(0,123,114,.85) 50% 58%, transparent 60%),
    linear-gradient(135deg, transparent 0 66%, rgba(0,123,114,.65) 68% 76%, transparent 78%);
  cursor: nwse-resize;
  opacity: 0;
}

.research-node.selected .research-resize-handle {
  opacity: 1;
}

.research-canvas-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  min-height: 30px;
  padding: 0 12px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.82);
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  pointer-events: none;
}

.research-reactor-figure {
  position: relative;
  height: 360px;
  margin: 4px auto;
  filter: drop-shadow(0 12px 18px rgba(16,22,21,.18));
}

.research-flow-figure {
  display: grid;
  min-height: 250px;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 18px 4px;
}

.research-flow-figure i {
  position: relative;
  display: block;
  height: 2px;
  border-radius: 999px;
  background: #007b72;
}

.research-flow-figure i::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -1px;
  width: 8px;
  height: 8px;
  transform: translateY(-50%) rotate(45deg);
  border-top: 2px solid #007b72;
  border-right: 2px solid #007b72;
}

.flow-step {
  display: grid;
  min-height: 138px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 14px 10px;
  border: 1px solid rgba(0, 123, 114, .24);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(241,249,245,.88));
  box-shadow: 0 12px 26px rgba(16,22,21,.08);
  text-align: center;
}

.flow-step small {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #007b72;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.flow-step strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
}

.flow-step em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

.reactor-body {
  position: absolute;
  left: 50%;
  bottom: 54px;
  width: 178px;
  height: 220px;
  transform: translateX(-50%);
  border: 4px solid #59625e;
  border-radius: 52px 52px 42px 42px;
  background: linear-gradient(90deg, #9aa29e 0%, #f8fbfa 44%, #adb5b1 72%, #68716d 100%);
}

.reactor-body::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: 30px;
  height: 22px;
  border: 3px solid #555e5a;
  border-radius: 999px;
  background: linear-gradient(90deg, #b8bfbc, #fff, #9da5a1);
}

.reactor-body strong {
  position: absolute;
  inset: 82px 0 auto;
  display: block;
  text-align: center;
  color: #111;
  font-size: 38px;
  letter-spacing: 0;
}

.reactor-motor,
.reactor-neck {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.reactor-motor {
  top: 10px;
  width: 82px;
  height: 74px;
  border: 3px solid #33485a;
  border-radius: 16px 16px 8px 8px;
  background: linear-gradient(90deg, #24384a, #6a94b8 45%, #25445d);
}

.reactor-neck {
  top: 82px;
  width: 46px;
  height: 62px;
  border: 3px solid #626b66;
  background: linear-gradient(90deg, #8b938f, #fff, #7e8783);
}

.reactor-leg {
  position: absolute;
  bottom: 0;
  width: 28px;
  height: 78px;
  border: 4px solid #606965;
  border-radius: 16px 16px 10px 10px;
  background: linear-gradient(90deg, #89918e, #fff, #69736e);
}

.reactor-leg.left { left: 98px; }
.reactor-leg.right { right: 98px; }

.reactor-pipe {
  position: absolute;
  top: 112px;
  width: 70px;
  height: 190px;
  border: 5px solid #59625e;
  border-bottom: 0;
  border-radius: 32px 32px 0 0;
}

.pipe-left { left: 20px; }
.pipe-right { right: 20px; }

.research-tool-grid {
  display: grid;
  gap: 8px;
}

.research-tool-grid.compact {
  grid-template-columns: 1fr 1fr;
}

.research-tool-grid button {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-height: 58px;
  padding: 10px;
  text-align: left;
}

.research-tool-grid button.active {
  border-color: #007b72;
  background: rgba(0, 123, 114, .1);
}

.research-tool-grid span {
  color: var(--muted);
  font-size: 11px;
}

.research-control-upload label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.research-control-upload input {
  width: 100%;
  font-size: 11px;
}

.research-preview-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.research-preview-row > div {
  display: grid;
  min-height: 104px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(0, 123, 114, .34);
  border-radius: 12px;
  background: rgba(255,255,255,.54);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.research-preview-row img {
  width: 100%;
  height: 104px;
  object-fit: cover;
}

.research-prompt-repo {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.research-prompt-repo button {
  display: grid;
  justify-items: start;
  gap: 5px;
  min-height: 70px;
  padding: 10px;
  text-align: left;
  white-space: normal;
}

.research-prompt-repo small {
  color: #00665f;
  font-size: 11px;
  font-weight: 900;
}

.research-prompt-repo span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.research-scss-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.research-scss-cards article {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 4px 8px;
  padding: 9px;
  border: 1px solid rgba(0, 123, 114, .18);
  border-radius: 10px;
  background: rgba(255,255,255,.58);
}

.research-scss-cards b {
  grid-row: span 2;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #00665f;
  color: #fff;
  font-size: 13px;
}

.research-scss-cards strong {
  color: var(--text);
  font-size: 12px;
}

.research-scss-cards span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.research-skill-note {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(166, 111, 0, .22);
  border-radius: 12px;
  background: rgba(255, 248, 230, .72);
}

.research-skill-note strong {
  color: var(--text);
  font-size: 13px;
}

.research-skill-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.research-skill-list {
  display: grid;
  gap: 8px;
}

.research-skill-list button {
  display: grid;
  justify-items: start;
  gap: 5px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(0, 123, 114, .18);
  border-radius: 11px;
  background: rgba(255,255,255,.6);
  text-align: left;
  white-space: normal;
}

.research-skill-list button.active {
  border-color: #007b72;
  background: rgba(0, 123, 114, .1);
  box-shadow: inset 0 0 0 1px rgba(0, 123, 114, .12);
}

.research-skill-list strong {
  color: var(--text);
  font-size: 13px;
}

.research-skill-list span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.research-empty-box {
  display: grid;
  width: 100%;
  min-height: 118px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.74);
  color: var(--muted);
  padding: 12px;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

@media (max-width: 1100px) {
  .research-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .research-head-main {
    text-align: left;
  }

  .research-head p {
    white-space: normal;
  }

  .research-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .research-canvas-card {
    min-height: 520px;
  }

  .research-editor-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .research-toolbar-right {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .research-workbench {
    padding: 14px 14px 64px;
  }

  .research-head h2 {
    font-size: 24px;
  }

  .research-head-nav,
  .research-head-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 1px;
  }

  .research-canvas {
    min-height: 500px;
  }

  .research-flow-figure {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .research-flow-figure i {
    width: 2px;
    height: 24px;
    justify-self: center;
  }

  .research-flow-figure i::after {
    top: auto;
    right: 50%;
    bottom: -1px;
    transform: translateX(50%) rotate(135deg);
  }
}

@media (max-width: 780px) {
  body.studio-active {
    overflow: hidden;
  }

  .app-shell {
    height: 100svh;
    min-height: 100svh;
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .workspace {
    min-width: 0;
    height: 100svh;
    min-height: 100svh;
    overflow: hidden;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 14;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: auto;
    padding: 8px 10px;
  }

  .topbar-cluster {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar-cluster::-webkit-scrollbar {
    display: none;
  }

  .topbar-home-button,
  .topbar-toggle,
  .media-count-pill {
    min-width: 44px;
    min-height: 44px;
    white-space: nowrap;
  }

  .topbar-cluster.right {
    justify-content: end;
  }

  .canvas {
    height: calc(100svh - 60px);
    min-height: 0;
    overflow: auto;
    padding: 12px 10px 250px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .image-card {
    border-radius: 8px;
  }

  .image-card img,
  .image-card figure,
  .square-card-image img {
    max-height: 62svh;
    object-fit: contain;
  }

  .gallery-header {
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .gallery-header button,
  .gallery-header a,
  .image-actions button,
  .image-actions a {
    min-height: 44px;
  }

  .sidebar {
    display: block;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 34;
    width: min(86vw, 320px);
    max-width: 320px;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 18px 0 42px rgba(21,24,20,.2);
  }

  .app-shell.left-open .sidebar {
    transform: translateX(0);
  }

  .settings-panel {
    display: block;
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 35;
    width: min(92vw, 380px);
    max-width: 380px;
    height: 100svh;
    overflow: auto;
    transform: translateX(105%);
    transition: transform .22s ease;
    box-shadow: -18px 0 42px rgba(21,24,20,.2);
  }

  .app-shell.settings-open .settings-panel {
    transform: translateX(0);
  }

  .app-shell:not(.settings-open) .settings-panel {
    display: block;
  }

  .composer {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto;
    max-height: calc(100svh - 88px);
    overflow: auto;
    border-radius: 14px;
  }

  .agent-mode-strip,
  .agent-quickbar,
  .composer-meta,
  .composer-tools {
    gap: 8px;
  }

  .agent-mode-strip {
    align-items: start;
    grid-template-columns: minmax(0, 1fr) 52px;
  }

  .agent-quickbar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .agent-chip,
  .subtle-button,
  .agent-clear-button {
    min-height: 44px;
    white-space: nowrap;
  }

  .composer-main,
  .composer.has-prompt .composer-main,
  .composer.agent-applied .composer-main,
  .composer.agent-mode-enabled .composer-main {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .upload-button {
    width: 46px;
    min-width: 46px;
    min-height: 92px;
    align-self: stretch;
  }

  .composer-main textarea,
  .composer.has-prompt .composer-main textarea,
  .composer.agent-applied .composer-main textarea,
  .composer.agent-mode-enabled .composer-main textarea {
    grid-column: 2;
    grid-row: 1;
    height: 112px;
    min-height: 112px;
    max-height: 28svh;
    font-size: 16px;
  }

  .composer-actionbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 44px 44px;
    gap: 8px;
    align-items: stretch;
    padding: 0 2px;
  }

  .composer-actionbar .preset-button,
  .composer-actionbar .prompt-optimize-button,
  .composer-actionbar .quick-config-button,
  .composer-actionbar .send-button,
  .composer-actionbar .clear-prompt-button {
    min-height: 44px;
    width: auto;
    min-width: 0;
    padding-inline: 8px;
  }

  .composer-actionbar .quick-config-button,
  .composer-actionbar .prompt-optimize-button,
  .composer-actionbar .preset-button {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .quick-config-panel {
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    width: auto;
    max-height: min(440px, calc(100svh - 260px));
    overflow: auto;
  }

  .quick-config-grid {
    grid-template-columns: 1fr 1fr;
  }

  .prompt-analysis-card {
    max-height: min(52svh, 430px);
    overflow: auto;
  }

  .composer-reference-list {
    max-height: 120px;
    overflow: auto;
  }
}

@media (max-width: 560px) {
  .canvas {
    padding-bottom: 286px;
  }

  .composer-actionbar {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .composer-actionbar .send-button,
  .composer-actionbar .clear-prompt-button {
    width: 100%;
  }

  .composer-meta {
    display: none;
  }

  .square-topbar-inline,
  .preset-library-topbar {
    gap: 8px;
    overflow-x: auto;
    padding-inline: 12px;
  }

  .home-market-section,
  .preset-library-page {
    padding: 14px 12px 32px;
  }

  .square-hero-inline,
  .preset-library-head,
  .preset-panel {
    border-radius: 8px;
  }

  .square-hero-inline {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .square-hero-inline h2,
  .preset-library-head h2 {
    font-size: 32px;
    line-height: 1.05;
  }

  .square-register-card,
  .square-refresh-button,
  .square-register-form button {
    width: 100%;
  }

  .square-register-form {
    grid-template-columns: 1fr;
  }

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

  .square-tabs button,
  .square-card-actions button,
  .preset-pagination button {
    min-height: 44px;
  }

  .square-grid,
  .preset-grid {
    grid-template-columns: 1fr;
  }

  .square-card {
    border-radius: 8px;
  }

  .preset-toolbar,
  .preset-footer {
    grid-template-columns: 1fr;
  }

  .preset-pagination {
    justify-content: stretch;
  }

  .preset-detail-modal {
    padding: 10px;
  }

  .preset-detail-panel {
    grid-template-columns: 1fr;
    max-height: calc(100svh - 20px);
  }

  .preset-detail-image {
    max-height: 42svh;
  }

  .preset-detail-content {
    padding: 18px;
  }

  .preset-detail-content h2 {
    font-size: 28px;
  }

  .preset-detail-prompt textarea {
    min-height: 240px;
    font-size: 13px;
  }

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