:root {
  color-scheme: light;
  --ink: #0b1832;
  --muted: #5c6981;
  --blue: #235cf6;
  --blue-deep: #123ead;
  --cyan: #5ae0ee;
  --violet: #9a7cff;
  --rose: #ff7598;
  --lime: #b8f06a;
  --glass: rgba(249, 252, 255, .62);
  --glass-strong: rgba(251, 253, 255, .82);
  --glass-line: rgba(255, 255, 255, .8);
  --shadow: 0 24px 60px rgba(23, 45, 82, .16), 0 3px 12px rgba(22, 55, 118, .08);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #dceaff; }
body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  font-family: Inter, "SF Pro Display", "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body:not(.theme-blue) {
  --product-nav-bg: rgba(222, 234, 243, .76);
  --product-nav-text: #53677d;
  --product-nav-active-bg: rgba(73, 104, 128, .18);
  --product-nav-active-text: #17324a;
  --product-nav-hover-bg: rgba(255, 255, 255, .48);
  --product-nav-hover-text: #28465e;
  --product-nav-border: rgba(255, 255, 255, .62);
  --product-nav-shadow: 0 10px 28px rgba(40, 69, 96, .12), inset 0 1px rgba(255, 255, 255, .55);
}
body.theme-blue {
  --product-nav-bg: rgba(232, 242, 251, .78);
  --product-nav-text: #536987;
  --product-nav-active-bg: rgba(47, 109, 255, .16);
  --product-nav-active-text: #2053c9;
  --product-nav-hover-bg: rgba(255, 255, 255, .5);
  --product-nav-hover-text: #2f5ea7;
  --product-nav-border: rgba(255, 255, 255, .72);
  --product-nav-shadow: 0 10px 28px rgba(47, 109, 255, .11), inset 0 1px rgba(255, 255, 255, .65);
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(35, 92, 246, .32);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

.wallpaper, .page-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.wallpaper {
  z-index: -3;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(230,242,255,.06), rgba(15,52,44,.05)),
    url("/static/creative-default-wallpaper-20260827.jpeg");
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
}
.wallpaper::before {
  content: "";
  position: absolute;
  inset: 47% -10% -18%;
  background:
    radial-gradient(ellipse at 20% 40%, rgba(52, 146, 84, .58), transparent 25%),
    radial-gradient(ellipse at 55% 35%, rgba(99, 177, 89, .45), transparent 28%),
    radial-gradient(ellipse at 92% 40%, rgba(63, 129, 75, .54), transparent 26%),
    linear-gradient(180deg, rgba(171, 218, 142, .52), rgba(72, 140, 80, .6));
  filter: saturate(.82);
  opacity: 0;
}
.wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,.12), transparent 35%, rgba(33,67,126,.06));
}
.wallpaper-orb { position: absolute; border-radius: 999px; opacity: .7; will-change: transform; }
.orb-a { width: 38vw; height: 38vw; top: -18vw; left: 30vw; background: rgba(255, 234, 180, .18); filter: blur(2px); }
.orb-b { width: 26vw; height: 26vw; right: -8vw; top: 18vh; background: rgba(169, 129, 255, .32); filter: blur(14px); }
.orb-c { width: 22vw; height: 22vw; left: -6vw; bottom: 8vh; background: rgba(68, 197, 228, .24); filter: blur(12px); }
.wallpaper-grain {
  position: absolute; inset: 0; opacity: .14; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E");
}
.page-vignette { z-index: -2; background: radial-gradient(circle at center, transparent 35%, rgba(17, 38, 65, .1)); }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.72);
  -webkit-backdrop-filter: blur(28px) saturate(1.28);
  backdrop-filter: blur(28px) saturate(1.28);
}
.creative-desktop {
  height: 100vh;
  height: 100dvh;
  padding: 22px 12px 12px;
  display: grid;
  grid-template-rows: 66px minmax(0, 1fr);
  gap: 12px;
}

.menubar {
  z-index: 160;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-radius: 22px;
  padding: 0 12px 0 16px;
}
.menubar-left { grid-column: 1; }
.menubar-actions { grid-column: 3; }
.menubar-left, .menubar-actions, .desktop-nav, .menubar-center { display: flex; align-items: center; }
.menubar-left { min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 13px;
  background: linear-gradient(145deg, #2b66ff, #123cae);
  box-shadow: 0 10px 24px rgba(35,92,246,.3), inset 0 1px rgba(255,255,255,.4);
}
.brand-mark svg { width: 26px; fill: none; stroke: white; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-type { display: grid; line-height: 1; gap: 4px; }
.brand-type strong { font-weight: 800; letter-spacing: -.04em; white-space: nowrap; }
.brand-type small { font-size: 8px; font-weight: 700; letter-spacing: .18em; color: var(--muted); }
.desktop-nav { justify-self: center; gap: 3px; padding: 4px; border: 1px solid rgba(11,24,50,.11); border-radius: 999px; background: rgba(11,18,14,.88); box-shadow: 0 10px 28px rgba(11,24,50,.13); }
.desktop-nav a {
  min-width: 86px; padding: 9px 16px; border-radius: 999px; text-decoration: none; color: rgba(255,255,255,.64); font-size: 12px; font-weight: 700; text-align: center;
  transition: color .2s ease, background .2s ease, transform .2s var(--ease);
}
.desktop-nav a:hover { color: #fff; background: rgba(255,255,255,.1); transform: translateY(-1px); }
.desktop-nav a.is-active { color: #fff; background: rgba(255,255,255,.14); box-shadow: inset 0 1px rgba(255,255,255,.12); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #4bca83; box-shadow: 0 0 0 4px rgba(75,202,131,.13); }
.menubar-actions { justify-content: flex-end; gap: 8px; }
.icon-button, .text-button, .quiet-button, .drawer-close {
  border: 0; cursor: pointer; transition: transform .2s var(--ease), background .2s ease, color .2s ease, box-shadow .2s ease;
}
.icon-button:hover, .text-button:hover, .quiet-button:hover { transform: translateY(-2px); }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.38); }
.icon-button svg, .text-button svg, .search-box svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button svg { width: 17px; }
.text-button { height: 36px; display: flex; align-items: center; gap: 7px; padding: 0 13px; border-radius: 12px; background: rgba(255,255,255,.42); font-size: 12px; font-weight: 700; }
.text-button svg { width: 16px; }
.service-state { padding: 7px 10px; border-radius: 999px; color: #18583b; background: rgba(204, 255, 222, .72); font-size: 10px; font-weight: 700; }
.service-state.is-partial { color: #815200; background: rgba(255,240,176,.76); }
.mobile-only { display: none; }

.desktop-stage { min-height: 0; display: grid; grid-template-columns: 318px minmax(0, 1fr); gap: 12px; }
.workspace { grid-column: 2; grid-row: 1; }
.workspace { min-width: 0; min-height: 0; border: 0; box-shadow: none; background: rgba(248,252,255,.16); border-radius: var(--radius-xl); padding: 16px; overflow: hidden; display: grid; grid-template-rows: auto minmax(0,1fr); -webkit-backdrop-filter: blur(8px) saturate(1.05); backdrop-filter: blur(8px) saturate(1.05); }
.workspace-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 0 4px 13px; }
.workspace-actions { min-width: min(760px, 65%); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.kicker { margin: 0 0 5px; font-size: 9px; line-height: 1.2; letter-spacing: .2em; color: var(--blue); font-weight: 800; }
.workspace-heading h1 { margin: 0; font-size: clamp(25px, 2.2vw, 36px); line-height: 1; letter-spacing: -.045em; }
.workspace-heading p:not(.kicker) { margin: 7px 0 0; font-size: 12px; color: var(--muted); }
.workspace-tools { display: flex; align-items: center; gap: 8px; }
.search-box { width: 210px; height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid rgba(87,112,160,.14); border-radius: 13px; background: rgba(255,255,255,.45); }
.search-box svg { width: 15px; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.quiet-button { height: 38px; padding: 0 13px; border-radius: 13px; background: rgba(20,36,64,.08); font-size: 11px; font-weight: 700; }
.repository-button { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.repository-button span { min-width: 21px; height: 21px; display: grid; place-items: center; border-radius: 999px; color: #fff; background: var(--blue); font-size: 9px; }
.workflow-canvas { position: relative; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(35,92,246,.24) transparent; }
.workflow-canvas::before {
  content: ""; position: absolute; inset: 0; min-height: 760px; pointer-events: none; opacity: .35;
  background-image: radial-gradient(circle, rgba(255,255,255,.42) 1px, transparent 1px); background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
}
.workflow-canvas::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  min-height: 100%;
  pointer-events: none;
  opacity: 0;
  background-image:
    linear-gradient(to right, rgba(35,92,246,.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(35,92,246,.08) 1px, transparent 1px);
  background-size: 104px 104px;
  transition: opacity .16s ease;
}
.workflow-canvas.is-grid-active::after { opacity: .72; }
.workflow-canvas::-webkit-scrollbar:horizontal { height: 0; }
.workflow-card {
  --accent: #235cf6;
  --accent-2: #5ae0ee;
  position: absolute; z-index: 2; left: 0; top: 0; width: 260px; height: 180px;
  border: 1px solid rgba(255,255,255,.82); border-radius: 24px; overflow: hidden;
  background: rgba(250,252,255,.71); box-shadow: 0 18px 40px rgba(36,62,104,.13), inset 0 1px rgba(255,255,255,.78);
  cursor: grab; user-select: none; touch-action: none; transform: translate3d(var(--x), var(--y), 0);
  transition: box-shadow .28s ease, border-color .28s ease, opacity .22s ease;
  will-change: transform;
}
.workflow-card:hover { border-color: color-mix(in srgb, var(--accent) 32%, white); box-shadow: 0 25px 54px rgba(28,53,96,.2), inset 0 1px rgba(255,255,255,.9); }
.workflow-card.is-dragging { z-index: 35; cursor: grabbing; opacity: .92; box-shadow: 0 34px 70px rgba(20,44,87,.25); }
.workflow-card.is-running { border-color: rgba(33,185,141,.76); }
.workflow-card.is-complete { border-color: rgba(53,188,113,.72); }
.workflow-card.is-blocked { border-color: #ef476f; box-shadow: 0 0 0 4px rgba(239,71,111,.12), 0 25px 54px rgba(28,53,96,.2); }
.workflow-card.is-model-card .card-art-icon { border-radius: 50%; }
.workflow-card.is-model-card .card-art::after { opacity: .58; }
.workflow-card[hidden] { display: none; }
.card-art { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 18%, white), color-mix(in srgb, var(--accent-2) 24%, white)); }
.card-art::before, .card-art::after { content: ""; position: absolute; border-radius: 50%; will-change: transform; }
.card-art::before { width: 150px; height: 150px; right: -32px; top: -52px; background: var(--accent-2); opacity: .62; }
.card-art::after { width: 110px; height: 110px; left: -22px; bottom: -44px; background: var(--accent); opacity: .36; }
.card-art span { position: absolute; inset: 15px; border: 1px solid rgba(255,255,255,.45); border-radius: 18px; background: linear-gradient(130deg, rgba(255,255,255,.25), transparent); }
.card-art i { position: absolute; display: block; background: rgba(255,255,255,.68); box-shadow: 0 7px 18px rgba(21,43,86,.09); }
.card-art i:nth-child(2) { width: 48px; height: 48px; border-radius: 15px; right: 24px; top: 25px; transform: rotate(12deg); }
.card-art i:nth-child(3) { width: 76px; height: 12px; border-radius: 999px; left: 24px; top: 37px; }
.card-art i:nth-child(4) { width: 46px; height: 12px; border-radius: 999px; left: 24px; top: 55px; opacity: .65; }
.card-art-icon { position: absolute; right: 35px; bottom: 24px; width: 62px; height: 62px; display: grid; place-items: center; border-radius: 19px; color: white; background: color-mix(in srgb, var(--accent) 80%, #0a1c42); box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 28%, transparent); }
.card-art-icon svg { width: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card-copy { position: absolute; inset: auto 14px 14px; padding: 12px 13px; border: 1px solid rgba(255,255,255,.72); border-radius: 17px; background: rgba(252,253,255,.75); backdrop-filter: blur(17px); box-shadow: 0 9px 24px rgba(21,45,88,.12); }
.card-copy-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-copy h3 { margin: 0; max-width: calc(100% - 32px); font-size: 15px; line-height: 1.15; letter-spacing: -.02em; }
.card-copy p { margin: 5px 0 0; max-width: 82%; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-number { font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-meta { margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.card-meta span { padding: 4px 7px; border-radius: 999px; color: color-mix(in srgb, var(--accent) 80%, #07152e); background: color-mix(in srgb, var(--accent) 11%, white); font-size: 8px; font-weight: 700; }
.card-open { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 11px; display: grid; place-items: center; color: var(--ink); background: rgba(255,255,255,.74); cursor: pointer; z-index: 2; }
.card-open svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.card-resize { position: absolute; right: 4px; bottom: 4px; width: 24px; height: 24px; cursor: nwse-resize; z-index: 4; }
.card-resize::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 8px; height: 8px; border-right: 2px solid rgba(27,46,80,.48); border-bottom: 2px solid rgba(27,46,80,.48); }
.card-live-state {
  position: absolute; z-index: 7; left: 14px; right: auto; top: 14px; width: min(154px, calc(100% - 64px)); min-height: 25px; display: none;
  grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 7px; border: 0; border-radius: 12px;
  padding: 5px 8px; color: #0b3562; background: rgba(239,248,255,.9); box-shadow: 0 8px 20px rgba(22,54,98,.1);
  font-size: 8px; font-weight: 750; text-align: left; cursor: pointer; backdrop-filter: blur(14px);
}
.card-live-state.is-visible { display: grid; }
.card-live-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px rgba(35,92,246,.1); }
.card-live-state.is-running i { background: #20b98b; animation: live-pulse 1.4s ease-in-out infinite; }
.card-live-state.is-complete i { background: #35bc71; }
.card-live-state.is-error { color: #8e2840; background: rgba(255,239,244,.9); }
.card-live-state.is-error i { background: #ef476f; box-shadow: 0 0 0 4px rgba(239,71,111,.11); }
.card-live-state span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-live-state b { font-variant-numeric: tabular-nums; }
@keyframes live-pulse { 50% { opacity: .35; transform: scale(.72); } }
.grid-placeholder,
.resize-ghost {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 28;
  pointer-events: none;
  border: 2px dashed rgba(35,92,246,.72);
  border-radius: 24px;
  background: rgba(221,234,255,.48);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.18), 0 16px 38px rgba(35,92,246,.12);
}
.grid-placeholder { opacity: .82; transform: translate3d(var(--placeholder-x), var(--placeholder-y), 0); transition: transform .18s cubic-bezier(.2,.8,.2,1), width .18s ease, height .18s ease; }
.resize-ghost { z-index: 45; border-style: solid; transform: translate3d(var(--ghost-x), var(--ghost-y), 0); }
.empty-search { min-height: 280px; place-items: center; align-content: center; gap: 10px; color: var(--muted); }
.empty-search:not([hidden]) { display: grid; }
.empty-search button { border: 0; color: var(--blue); background: none; cursor: pointer; }

.side-rail { min-height: 0; grid-column: 1; grid-row: 1; display: grid; grid-template-rows: minmax(0, 1fr); }
.task-monitor { min-height: 0; padding: 18px; border-radius: 28px; overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.035em; }
.count-pill { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 11px; font-size: 11px; font-weight: 700; }
.count-pill { color: white; background: var(--ink); }
.panel-note { margin: 9px 0 11px; color: var(--muted); font-size: 10px; }
.panel-empty { height: calc(100% - 40px); min-height: 145px; display: grid; place-items: center; align-content: center; text-align: center; }
.panel-empty strong { margin-top: 8px; font-size: 13px; }
.panel-empty p { max-width: 220px; margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.pulse-ring { position: relative; width: 44px; height: 44px; border: 1px solid rgba(35,92,246,.15); border-radius: 50%; display: grid; place-items: center; }
.pulse-ring::after { content: ""; position: absolute; inset: 4px; border: 1px solid rgba(35,92,246,.2); border-radius: inherit; animation: pulse 2.6s ease-out infinite; }
.pulse-ring i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 18px rgba(35,92,246,.55); }
@keyframes pulse { 0% { transform: scale(.7); opacity: .9; } 80%,100% { transform: scale(1.8); opacity: 0; } }
.task-list { display: grid; gap: 8px; max-height: calc(100% - 42px); margin-top: 12px; overflow: auto; }
.task-item { position: relative; padding: 11px 12px 12px; border-radius: 16px; background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.72); overflow: hidden; cursor: pointer; transition: border-color .18s ease, background-color .18s ease; }
.task-item:hover, .task-item.is-expanded { border-color: rgba(35,92,246,.3); background: rgba(249,252,255,.82); }
.task-item-head { display: flex; justify-content: space-between; gap: 8px; }
.task-item strong { font-size: 11px; }
.task-item small { color: var(--muted); font-size: 9px; }
.task-bar { height: 3px; margin-top: 9px; border-radius: 99px; overflow: hidden; background: rgba(27,47,84,.1); }
.task-bar i { display: block; height: 100%; width: var(--progress); border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .5s var(--ease); }
.task-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 7px; }
.task-actions button, .task-actions a { border: 0; color: var(--blue); background: none; font-size: 9px; text-decoration: none; cursor: pointer; }
.task-details { display: none; margin-top: 10px; padding-top: 9px; border-top: 1px solid rgba(75,100,147,.11); gap: 6px; }
.task-item.is-expanded .task-details { display: grid; }
.task-details span { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 8px; align-items: start; font-size: 8px; }
.task-details b { color: var(--muted); font-weight: 650; }
.task-details em { min-width: 0; overflow-wrap: anywhere; color: var(--ink); font-style: normal; line-height: 1.45; }
.ai-header-button,
.ai-floating-button,
.ai-send-button,
.ai-attach-button,
.ai-reset-button,
.ai-quick-actions button,
.ai-action-button {
  border: 0;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s ease, background .2s ease;
}
.ai-header-button {
  min-height: 36px; display: inline-flex; align-items: center; gap: 7px; border-radius: 12px;
  padding: 0 13px; color: #4f3800;
  background: linear-gradient(135deg, rgba(255,239,174,.9), rgba(245,194,81,.82));
  box-shadow: 0 8px 22px rgba(161,111,18,.14), inset 0 1px rgba(255,255,255,.66);
  font-size: 11px; font-weight: 800;
}
.ai-header-button span { font-size: 15px; }
.ai-header-button:hover, .ai-floating-button:hover, .ai-send-button:hover { transform: translateY(-2px); }
.ai-floating-button {
  position: fixed; z-index: 150; right: 20px; bottom: 20px; min-height: 50px;
  display: inline-flex; align-items: center; gap: 9px; border: 1px solid rgba(255,255,255,.7);
  border-radius: 18px; padding: 0 17px; color: #4d3600;
  background: linear-gradient(135deg, #fff2bb, #eeba50);
  box-shadow: 0 18px 42px rgba(77,54,0,.2), inset 0 1px rgba(255,255,255,.8);
}
.ai-floating-button span { font-size: 21px; }
.ai-floating-button b { font-size: 12px; }
.ai-panel-backdrop {
  position: fixed; z-index: 264; inset: 0; border: 0;
  background: rgba(9,20,38,.24); backdrop-filter: blur(7px);
}
.ai-panel {
  position: fixed; z-index: 265; top: 14px; right: 14px; bottom: 14px;
  width: min(780px, calc(100vw - 28px)); min-height: 0;
  display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden;
  border: 1px solid rgba(255,255,255,.88); border-radius: 30px; color: var(--ink);
  background: rgba(241,247,253,.93);
  box-shadow: 0 34px 100px rgba(13,31,59,.3), inset 0 1px rgba(255,255,255,.92);
  backdrop-filter: blur(30px) saturate(1.2);
}
.ai-panel-header {
  display: grid; grid-template-columns: 46px minmax(0,1fr) auto auto 38px;
  align-items: center; gap: 11px; padding: 17px 18px 13px;
  border-bottom: 1px solid rgba(52,77,118,.08);
}
.ai-agent-mark {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px;
  color: #5c3c00; background: linear-gradient(145deg, #fff0a8, #eeb94d);
  box-shadow: 0 10px 24px rgba(127,88,14,.18), inset 0 1px rgba(255,255,255,.7);
  font-size: 22px;
}
.ai-panel-header h2 { margin: 0; font-size: 20px; letter-spacing: -.035em; }
.ai-panel-header .kicker { margin-bottom: 3px; color: #9a6c10; }
.ai-panel-header small { color: var(--muted); font-size: 9px; }
.ai-panel-header small b { color: var(--ink); font-weight: 750; }
.ai-reset-button {
  min-height: 32px; border-radius: 10px; padding: 0 10px;
  color: var(--muted); background: rgba(17,37,68,.06); font-size: 9px; font-weight: 750;
}
.ai-history-toggle {
  min-height: 32px; border: 0; border-radius: 10px; padding: 0 10px;
  color: #315181; background: rgba(35,92,246,.08); cursor: pointer; font-size: 9px; font-weight: 800;
}
.ai-panel-shell { min-height: 0; display: grid; grid-template-columns: 210px minmax(0,1fr); }
.ai-conversation { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.ai-history-rail {
  min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto auto minmax(0,1fr); gap: 10px;
  padding: 13px 11px; border-right: 1px solid rgba(52,77,118,.09); background: rgba(229,238,248,.62);
}
.ai-history-rail > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-history-rail > header div { min-width: 0; display: grid; gap: 2px; }
.ai-history-rail > header strong { font-size: 12px; }
.ai-history-rail > header small { color: var(--muted); font-size: 7px; }
.ai-history-rail > header button {
  flex: none; min-height: 28px; border: 0; border-radius: 9px; padding: 0 8px; color: #fff;
  background: var(--blue); cursor: pointer; font-size: 8px; font-weight: 800;
}
.ai-history-search {
  min-height: 32px; display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 6px;
  padding: 0 9px; border: 1px solid rgba(75,100,145,.1); border-radius: 10px; background: rgba(255,255,255,.68);
}
.ai-history-search span { color: var(--muted); font-size: 13px; }
.ai-history-search input { min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 8px; }
.ai-history-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(29,55,96,.05); }
.ai-history-tabs button { min-height: 27px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 8px; font-weight: 750; }
.ai-history-tabs button span { min-width: 16px; display: inline-grid; place-items: center; margin-left: 3px; padding: 2px 4px; border-radius: 999px; background: rgba(17,37,68,.06); font-size: 7px; }
.ai-history-tabs button.is-active { color: #1f55c5; background: rgba(255,255,255,.82); box-shadow: 0 4px 10px rgba(35,69,119,.07); }
.ai-history-tabs button.is-active span { color: #fff; background: var(--blue); }
.ai-history-list { min-height: 0; display: grid; align-content: start; gap: 11px; overflow: auto; padding-right: 2px; }
.ai-history-empty { display: grid; justify-items: center; gap: 6px; padding: 38px 10px; color: var(--muted); line-height: 1.55; text-align: center; }
.ai-history-empty > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; color: var(--blue); background: rgba(35,92,246,.08); font-size: 15px; }
.ai-history-empty strong { color: #43516a; font-size: 9px; }
.ai-history-empty p { margin: 0; font-size: 7px; }
.ai-history-empty button { min-height: 29px; margin-top: 3px; border: 0; border-radius: 9px; padding: 0 10px; color: #fff; background: var(--blue); cursor: pointer; font-size: 8px; font-weight: 800; }
.ai-history-group { display: grid; gap: 6px; }
.ai-history-group h3 { margin: 0; padding: 0 3px; color: #7a889e; font-size: 7px; font-weight: 800; letter-spacing: .04em; }
.ai-history-item {
  position: relative; display: grid; gap: 4px; padding: 10px 9px 9px; border: 1px solid rgba(79,102,143,.1);
  border-radius: 13px; color: var(--ink); background: rgba(255,255,255,.56); cursor: pointer;
}
.ai-history-item:hover { border-color: rgba(35,92,246,.22); background: rgba(255,255,255,.78); }
.ai-history-item.is-active { border-color: rgba(35,92,246,.38); background: rgba(234,241,255,.94); box-shadow: inset 3px 0 var(--blue); }
.ai-history-item-title { min-width: 0; display: flex; align-items: center; gap: 4px; padding-right: 23px; }
.ai-history-item strong { min-width: 0; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.ai-history-item-title em { flex: none; padding: 2px 5px; border-radius: 999px; color: #1d57d1; background: rgba(35,92,246,.09); font-size: 6px; font-style: normal; font-weight: 800; }
.ai-history-item-title i { flex: none; color: #e0a927; font-size: 6px; font-style: normal; }
.ai-history-item p { margin: 0; overflow: hidden; color: var(--muted); font-size: 7px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.ai-history-item small { color: #8290a7; font-size: 7px; }
.ai-history-menu { position: absolute; z-index: 4; top: 5px; right: 5px; }
.ai-history-menu summary { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); cursor: pointer; font-size: 9px; letter-spacing: -.08em; list-style: none; }
.ai-history-menu summary::-webkit-details-marker { display: none; }
.ai-history-menu summary:hover, .ai-history-menu[open] summary { color: var(--blue); background: rgba(35,92,246,.08); }
.ai-history-menu > div { position: absolute; top: 25px; right: 0; width: 94px; display: grid; gap: 2px; padding: 5px; border: 1px solid rgba(68,91,130,.14); border-radius: 10px; background: rgba(250,252,255,.98); box-shadow: 0 14px 34px rgba(24,44,78,.2); }
.ai-history-menu button { min-height: 26px; border: 0; border-radius: 7px; padding: 0 7px; color: #34445f; background: transparent; cursor: pointer; font-size: 7px; text-align: left; }
.ai-history-menu button:hover { color: var(--blue); background: rgba(35,92,246,.07); }
.ai-history-menu button.is-danger:hover { color: #b42e48; background: rgba(209,62,91,.08); }
.ai-panel.is-history-collapsed .ai-panel-shell { grid-template-columns: minmax(0,1fr); }
.ai-panel.is-history-collapsed .ai-history-rail { display: none; }
.ai-parameter-card {
  margin: 10px 14px 0; border: 1px solid rgba(226,174,67,.2);
  border-radius: 18px; background: rgba(255,249,230,.72); overflow: visible;
}
.ai-parameter-header {
  min-height: 44px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 7px 11px 7px 13px;
}
.ai-parameter-header > div:first-child { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.ai-parameter-header strong { flex: none; font-size: 10px; }
.ai-parameter-header small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.ai-parameter-toggle {
  flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px;
  border-radius: 10px; background: rgba(17,37,68,.06);
}
.ai-parameter-toggle button {
  min-width: 42px; height: 26px; border: 0; border-radius: 8px; color: var(--muted);
  background: transparent; cursor: pointer; font-size: 8px; font-weight: 800;
}
.ai-parameter-toggle button[aria-pressed="true"] {
  color: #fff; background: var(--blue); box-shadow: 0 5px 12px rgba(35,92,246,.2);
}
.ai-parameter-body[hidden] { display: none; }
.ai-parameter-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 7px; padding: 0 11px 8px;
}
.ai-parameter-grid label, .ai-category-field, .ai-tags-field { display: grid; gap: 4px; min-width: 0; }
.ai-parameter-grid label > span, .ai-category-field > span, .ai-tags-field span { color: var(--muted); font-size: 8px; font-weight: 700; }
.ai-parameter-grid select, .ai-tags-field input {
  width: 100%; min-height: 32px; border: 1px solid rgba(91,105,132,.11);
  border-radius: 10px; padding: 0 8px; outline: 0; color: var(--ink);
  background: rgba(255,255,255,.72); font-size: 9px;
}
.ai-category-field { position: relative; }
.ai-category-trigger {
  width: 100%; min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  border: 1px solid rgba(91,105,132,.11); border-radius: 10px; padding: 0 8px;
  color: var(--ink); background: rgba(255,255,255,.72); cursor: pointer; text-align: left;
}
.ai-category-trigger b { min-width: 0; overflow: hidden; font-size: 9px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ai-category-trigger i { color: var(--muted); font-size: 14px; font-style: normal; transform: rotate(90deg); }
.ai-category-menu {
  position: absolute; z-index: 32; top: calc(100% + 6px); left: 0; width: min(410px, calc(100vw - 54px));
  max-height: 330px; overflow: auto; padding: 10px; border: 1px solid rgba(83,104,143,.16);
  border-radius: 14px; background: rgba(248,251,255,.98); box-shadow: 0 20px 48px rgba(23,43,77,.22);
}
.ai-category-menu[hidden] { display: none; }
.ai-category-menu section + section { margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(57,79,117,.08); }
.ai-category-menu section > strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 8px; }
.ai-category-menu section > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
.ai-category-menu label { min-width: 0; display: flex; align-items: center; gap: 5px; padding: 6px 7px; border-radius: 8px; color: #34425a; background: rgba(35,92,246,.04); font-size: 8px; }
.ai-category-menu input { margin: 0; accent-color: var(--blue); }
.ai-color-control { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px; }
.ai-color-control input[type="color"] { width: 32px; min-height: 32px; padding: 3px; border: 1px solid rgba(91,105,132,.15); border-radius: 9px; background: #fff; cursor: pointer; }
.ai-color-control output { grid-column: 1 / -1; color: var(--muted); font-size: 7px; }
.ai-model-parameters { margin: 0 11px 9px; padding: 9px; border: 1px solid rgba(35,92,246,.1); border-radius: 12px; background: rgba(239,245,255,.56); }
.ai-model-parameters[hidden] { display: none; }
.ai-model-parameters header { display: flex; align-items: baseline; gap: 7px; margin-bottom: 7px; }
.ai-model-parameters header strong { font-size: 9px; }
.ai-model-parameters header small { color: var(--muted); font-size: 7px; }
.ai-model-parameter-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.ai-model-parameter-grid label { min-width: 0; display: grid; gap: 4px; }
.ai-model-parameter-grid label span { color: var(--muted); font-size: 8px; font-weight: 700; }
.ai-model-parameter-grid select { width: 100%; min-height: 31px; border: 1px solid rgba(91,105,132,.11); border-radius: 9px; padding: 0 7px; color: var(--ink); background: rgba(255,255,255,.8); font-size: 8px; }
.ai-tags-field { padding: 0 11px 11px; }
.ai-parameter-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px 11px; border-top: 1px solid rgba(151,116,43,.1);
}
.ai-parameter-footer span { color: var(--muted); font-size: 7px; line-height: 1.4; }
.ai-parameter-footer button {
  flex: none; min-height: 30px; border: 0; border-radius: 10px; padding: 0 12px;
  color: #fff; background: var(--blue); box-shadow: 0 7px 16px rgba(35,92,246,.2);
  cursor: pointer; font-size: 8px; font-weight: 800;
}
.ai-parameter-footer button:disabled { opacity: .55; cursor: wait; }
.ai-messages {
  min-height: 0; display: flex; flex-direction: column; gap: 11px;
  overflow-y: auto; padding: 14px 16px 18px; overscroll-behavior: contain;
}
.ai-message { max-width: 88%; display: grid; gap: 7px; align-self: flex-start; }
.ai-message.is-user { align-self: flex-end; }
.ai-message-bubble {
  padding: 11px 13px; border-radius: 16px 16px 16px 5px; color: #26334a;
  background: rgba(255,255,255,.78); box-shadow: 0 6px 18px rgba(30,51,83,.07);
  font-size: 11px; line-height: 1.65; white-space: pre-wrap;
}
.ai-message.is-user .ai-message-bubble {
  border-radius: 16px 16px 5px 16px; color: white;
  background: linear-gradient(145deg, #2e67fa, #1749cb);
}
.ai-message-time { padding-inline: 3px; color: var(--muted); font-size: 7px; }
.ai-message.is-user .ai-message-time { text-align: right; }
.ai-option-row, .ai-confirm-actions, .ai-result-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-action-button, .ai-option-row button {
  min-height: 30px; border: 0; border-radius: 10px; padding: 0 11px;
  color: #214ba7; background: rgba(35,92,246,.09); cursor: pointer;
  font-size: 9px; font-weight: 750;
}
.ai-action-button.is-primary { color: #fff; background: var(--blue); }
.ai-action-button.is-danger { color: #a62a42; background: rgba(209,62,91,.1); }
.ai-action-button:disabled { opacity: .55; cursor: wait; }
.ai-confirm-card {
  display: grid; gap: 8px; padding: 11px; border: 1px solid rgba(229,175,68,.25);
  border-radius: 15px; background: rgba(255,247,220,.72);
}
.ai-confirm-card strong { font-size: 10px; }
.ai-confirm-card p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.ai-confirm-params { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.ai-confirm-params span {
  display: grid; gap: 2px; padding: 7px 8px; border-radius: 9px;
  color: var(--muted); background: rgba(255,255,255,.58); font-size: 8px;
}
.ai-confirm-params b { color: var(--ink); font-size: 8px; }
.ai-material-grid, .ai-result-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; }
.ai-material-card, .ai-result-card {
  position: relative; min-width: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.78);
  border-radius: 13px; background: rgba(255,255,255,.58);
}
.ai-material-card > button, .ai-result-card > button {
  width: 100%; aspect-ratio: 1; display: block; border: 0; padding: 0;
  background: rgba(11,24,50,.06); cursor: zoom-in;
}
.ai-material-card img, .ai-result-card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.ai-material-card label {
  position: absolute; left: 6px; top: 6px; width: 20px; height: 20px;
  display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.9);
}
.ai-material-card input { margin: 0; accent-color: var(--blue); }
.ai-material-card p {
  margin: 0; padding: 6px 7px; display: flex; align-items: center; gap: 5px; font-size: 8px;
}
.ai-material-card p span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-material-card p button { flex: none; border: 0; padding: 0; color: var(--blue); background: none; cursor: pointer; font-size: 7px; }
.ai-result-heading { margin: 3px 0 0; color: var(--muted); font-size: 8px; font-weight: 800; }
.ai-reference-status { margin: 2px 0 0; padding: 7px 9px; border-radius: 9px; font-size: 7px; line-height: 1.45; }
.ai-reference-status.is-online { color: #176445; background: rgba(47,190,127,.1); }
.ai-reference-status.is-fallback { color: #8a5a09; background: rgba(226,174,67,.13); }
.ai-reference-grid, .ai-generated-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.ai-reference-card, .ai-generated-card {
  position: relative; min-width: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.8);
  border-radius: 13px; background: rgba(255,255,255,.6);
}
.ai-reference-card > button, .ai-generated-card > button {
  width: 100%; aspect-ratio: 1; display: block; border: 0; padding: 0;
  background: rgba(11,24,50,.06); cursor: zoom-in;
}
.ai-reference-media { position: relative; overflow: hidden; }
.ai-reference-image-state {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12px;
  color: var(--muted); background: linear-gradient(145deg,rgba(235,241,249,.94),rgba(224,231,241,.9));
  font-size: 8px; line-height: 1.5; text-align: center;
}
.ai-reference-card img, .ai-generated-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-reference-card img { position: relative; opacity: 0; transition: opacity .18s ease; }
.ai-reference-card.is-image-ready img { opacity: 1; }
.ai-reference-card.is-image-ready .ai-reference-image-state { display: none; }
.ai-reference-card.is-image-error .ai-reference-image-state { color: #8a5a09; background: rgba(255,246,224,.96); }
.ai-reference-card footer { display: grid; gap: 2px; padding: 6px 7px; }
.ai-reference-card footer strong { overflow: hidden; color: var(--ink); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.ai-reference-card footer span { color: var(--muted); font-size: 7px; }
.ai-reference-card footer a { width: max-content; color: var(--blue); font-size: 7px; text-decoration: none; }
.ai-reference-card footer .ai-reference-title-link {
  width: 100%; overflow: hidden; color: var(--ink); font-size: 8px; font-weight: 850;
  text-overflow: ellipsis; white-space: nowrap;
}
.ai-reference-card footer .ai-reference-title-link:hover,
.ai-reference-card footer .ai-reference-title-link:focus-visible { color: var(--blue); text-decoration: underline; }
.ai-reference-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding-top: 3px; }
.ai-reference-card-actions button, .ai-reference-card-actions a {
  min-height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0;
  border-radius: 7px; padding: 0 7px; color: #214ba7; background: rgba(35,92,246,.09);
  cursor: pointer; font-size: 7px; font-weight: 800;
}
.ai-reference-card-actions button:disabled { opacity: .48; cursor: not-allowed; }
.ai-reference-card-actions .ai-reference-source-link { color: #fff; background: var(--blue); }
.ai-reference-more {
  width: 100%; min-height: 34px; border: 1px solid rgba(35,92,246,.14); border-radius: 11px;
  color: #214ba7; background: rgba(255,255,255,.68); cursor: pointer; font-size: 8px; font-weight: 850;
}
.ai-reference-more:hover, .ai-reference-more:focus-visible { border-color: rgba(35,92,246,.38); background: rgba(239,245,255,.94); }
.ai-integration-card {
  display: grid; gap: 10px; padding: 12px; border: 1px solid rgba(42,97,205,.16);
  border-radius: 16px; background: rgba(238,246,255,.84);
}
.ai-integration-card header { display: flex; align-items: center; gap: 9px; }
.ai-integration-card header > span {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px;
  color: #fff; background: linear-gradient(145deg,#2d6cf5,#1846b9); font-size: 9px; font-weight: 900;
}
.ai-integration-card header div { min-width: 0; display: grid; gap: 2px; }
.ai-integration-card header strong { font-size: 10px; }
.ai-integration-card header small { color: var(--muted); font-size: 8px; }
.ai-integration-card ul { margin: 0; padding-left: 17px; color: #43516a; font-size: 8px; line-height: 1.65; }
.ai-integration-card > label { display: flex; align-items: flex-start; gap: 6px; color: var(--muted); font-size: 8px; line-height: 1.5; }
.ai-integration-card > label input { margin: 1px 0 0; accent-color: var(--blue); }
.ai-integration-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-integration-actions button {
  min-height: 31px; border: 0; border-radius: 10px; padding: 0 10px;
  color: #214ba7; background: rgba(35,92,246,.09); cursor: pointer; font-size: 8px; font-weight: 800;
}
.ai-integration-actions button.is-primary { color: #fff; background: var(--blue); }
.ai-integration-actions button:disabled { opacity: .58; cursor: wait; }
.ai-integration-card.is-connected { border-color: rgba(42,164,105,.22); background: rgba(235,250,242,.86); }
.ai-redfox-search {
  display: grid; gap: 9px; padding: 11px; border: 1px solid rgba(35,92,246,.13);
  border-radius: 15px; background: rgba(244,248,255,.88);
}
.ai-redfox-search header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-redfox-search header div { display: grid; gap: 2px; }
.ai-redfox-search header strong { font-size: 10px; }
.ai-redfox-search header small { color: var(--muted); font-size: 7px; }
.ai-redfox-badge { padding: 4px 7px; border-radius: 999px; color: #176445; background: rgba(47,190,127,.11); font-size: 7px; font-weight: 800; }
.ai-redfox-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.ai-redfox-grid label { min-width: 0; display: grid; gap: 4px; color: var(--muted); font-size: 7px; font-weight: 700; }
.ai-redfox-grid select, .ai-redfox-query {
  width: 100%; min-height: 33px; border: 1px solid rgba(73,96,137,.12); border-radius: 10px;
  padding: 0 8px; outline: 0; color: var(--ink); background: rgba(255,255,255,.85); font-size: 8px;
}
.ai-redfox-upload {
  min-height: 58px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto auto; align-items: center; gap: 8px;
  padding: 8px; border: 1px dashed rgba(35,92,246,.24); border-radius: 12px; outline: 0;
  background: rgba(255,255,255,.52); cursor: pointer; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.ai-redfox-upload:hover, .ai-redfox-upload:focus-visible, .ai-redfox-upload.is-dragover, .ai-redfox-upload.is-active { border-color: rgba(35,92,246,.5); background: rgba(239,245,255,.9); }
.ai-redfox-upload:focus-visible { box-shadow: 0 0 0 3px rgba(35,92,246,.12); }
.ai-redfox-upload.is-ready { border-style: solid; border-color: rgba(38,166,103,.34); background: rgba(239,251,246,.82); }
.ai-redfox-upload.is-error { border-color: #d94f68; box-shadow: 0 0 0 3px rgba(217,79,104,.1); }
.ai-redfox-upload-icon, .ai-redfox-upload img { width: 34px; height: 34px; border-radius: 9px; }
.ai-redfox-upload [hidden] { display: none !important; }
.ai-redfox-upload-icon { display: grid; place-items: center; color: var(--blue); background: rgba(35,92,246,.09); font-size: 18px; }
.ai-redfox-upload img { display: block; object-fit: cover; }
.ai-redfox-upload div { min-width: 0; display: grid; gap: 3px; }
.ai-redfox-upload strong, .ai-redfox-upload small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-redfox-upload strong { color: #253752; font-size: 8px; }
.ai-redfox-upload small { color: var(--muted); font-size: 7px; }
.ai-redfox-upload button { min-height: 28px; border: 0; border-radius: 8px; padding: 0 9px; color: #2455be; background: rgba(35,92,246,.09); cursor: pointer; font-size: 7px; font-weight: 800; }
.ai-redfox-upload [data-rf-remove] { color: #a63c50; background: rgba(209,62,91,.08); }
.ai-redfox-foot { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
.ai-redfox-foot button { min-height: 34px; border: 0; border-radius: 10px; padding: 0 12px; color: #fff; background: var(--blue); cursor: pointer; font-size: 8px; font-weight: 800; }
.ai-redfox-foot button:disabled { opacity: .58; cursor: wait; }
.ai-redfox-hint { margin: 0; color: var(--muted); font-size: 7px; line-height: 1.55; }
.ai-reference-retry { justify-self: start; min-height: 30px; border: 0; border-radius: 9px; padding: 0 11px; color: #fff; background: var(--blue); cursor: pointer; font-size: 8px; font-weight: 800; }
.ai-reference-retry:disabled { opacity: .58; cursor: wait; }
.ai-reference-empty { display:grid; justify-items:start; gap:5px; padding:12px; border:1px dashed rgba(35,92,246,.22); border-radius:12px; color:var(--muted); background:rgba(245,249,255,.62); }
.ai-reference-empty strong { color:var(--ink); font-size:9px; }
.ai-reference-empty span { font-size:8px; line-height:1.55; }
.ai-reference-empty button { min-height:29px; border:0; border-radius:9px; padding:0 10px; color:#fff; background:var(--blue); cursor:pointer; font-size:8px; font-weight:800; }
.ai-generated-card label {
  position: absolute; left: 6px; right: 6px; top: 6px; display: flex; justify-content: space-between;
  align-items: center; gap: 5px; padding: 4px 6px; border-radius: 8px;
  color: var(--ink); background: rgba(255,255,255,.9); font-size: 7px;
}
.ai-generated-card input { margin: 0; accent-color: var(--blue); }
.ai-result-card footer { display: grid; gap: 5px; padding: 6px; }
.ai-result-card footer button {
  min-height: 26px; border: 0; border-radius: 8px; color: #fff;
  background: var(--blue); cursor: pointer; font-size: 8px;
}
.ai-review-note { padding: 7px 8px; border-radius: 10px; color: #176840; background: rgba(59,196,122,.1); font-size: 8px; line-height: 1.45; }
.ai-review-note.is-warning { color: #8b5d05; background: rgba(240,180,55,.12); }
.ai-composer {
  display: grid; gap: 8px; padding: 10px 14px 14px;
  border-top: 1px solid rgba(52,77,118,.08); background: rgba(248,251,255,.82);
}
.ai-composer-row { display: grid; grid-template-columns: 38px minmax(0,1fr) 42px; align-items: end; gap: 7px; }
.ai-attach-button, .ai-send-button { display: grid; place-items: center; color: var(--blue); background: rgba(35,92,246,.08); }
.ai-attach-button { width: 38px; height: 38px; border-radius: 12px; font-size: 24px; font-weight: 300; }
.ai-send-button {
  width: 42px; height: 42px; border-radius: 13px; color: #fff; background: var(--blue);
  box-shadow: 0 9px 22px rgba(35,92,246,.25);
}
.ai-send-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ai-send-button:disabled { opacity: .55; cursor: wait; }
.ai-composer textarea {
  width: 100%; min-height: 42px; max-height: 110px; resize: none;
  border: 1px solid rgba(79,102,144,.12); border-radius: 13px;
  padding: 11px 12px; outline: 0; color: var(--ink); background: rgba(255,255,255,.78);
  font-size: 10px; line-height: 1.45;
}
.ai-quick-actions { display: flex; gap: 6px; overflow-x: auto; }
.ai-quick-actions button {
  flex: none; min-height: 28px; border-radius: 999px; padding: 0 11px;
  color: #5c480f; background: rgba(234,190,94,.18); font-size: 8px; font-weight: 750;
}
.ai-attachment-tray { display: flex; gap: 6px; overflow-x: auto; }
.ai-attachment-chip { position: relative; flex: none; width: 52px; height: 52px; overflow: hidden; border-radius: 11px; background: rgba(11,24,50,.06); }
.ai-attachment-chip img { width: 100%; height: 100%; object-fit: cover; }
.ai-attachment-chip button {
  position: absolute; right: 3px; top: 3px; width: 17px; height: 17px;
  border: 0; border-radius: 6px; color: #fff; background: rgba(11,24,50,.7); cursor: pointer; font-size: 10px;
}

.primary-button { min-height: 46px; border: 0; border-radius: 15px; padding: 0 20px; color: white; background: var(--blue); box-shadow: 0 12px 28px rgba(35,92,246,.28); cursor: pointer; font-weight: 700; transition: transform .2s var(--ease), box-shadow .2s ease; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(35,92,246,.34); }

.drawer { position: fixed; z-index: 240; top: 92px; right: 18px; bottom: 18px; width: min(440px, calc(100vw - 36px)); padding: 20px; border-radius: 28px; background: rgba(244,249,255,.92); box-shadow: 0 30px 90px rgba(12,30,58,.28), inset 0 1px 0 rgba(255,255,255,.9); }
.workflow-repository { display: grid; grid-template-rows: auto auto auto minmax(0,1fr) auto; gap: 14px; width: min(520px, calc(100vw - 36px)); }
.repository-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.repository-filters { display: flex; gap: 7px; }
.repository-filters button { min-height: 30px; border: 0; border-radius: 10px; padding: 0 11px; color: var(--muted); background: rgba(17,37,68,.06); cursor: pointer; font-size: 9px; font-weight: 750; }
.repository-filters button.is-active { color: #fff; background: var(--blue); }
.repository-search { width: 100%; }
.repository-list { min-height: 0; overflow: auto; display: grid; align-content: start; gap: 8px; padding-right: 2px; }
.repository-item { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 10px; border: 1px solid rgba(255,255,255,.72); border-radius: 17px; background: rgba(255,255,255,.48); }
.repository-item-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: var(--item-accent); background: color-mix(in srgb, var(--item-accent) 12%, white); }
.repository-item-icon svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.repository-item-copy { min-width: 0; }
.repository-item-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.repository-item-copy strong em { display: inline-flex; margin-left: 6px; padding: 2px 5px; border-radius: 6px; color: var(--item-accent); background: color-mix(in srgb, var(--item-accent) 9%, white); font-size: 7px; font-style: normal; vertical-align: 1px; }
.repository-item-copy small { color: var(--muted); font-size: 9px; }
.repository-toggle { min-width: 76px; height: 32px; border: 0; border-radius: 11px; color: var(--blue); background: rgba(35,92,246,.09); cursor: pointer; font-size: 10px; font-weight: 700; }
.repository-toggle.is-visible { color: var(--muted); background: rgba(20,36,64,.07); }
.repository-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid rgba(75,100,147,.12); }
.repository-footer span { color: var(--muted); font-size: 10px; }
.drawer-header { display: flex; justify-content: space-between; align-items: center; }
.drawer-header h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.drawer-close { width: 36px; height: 36px; border-radius: 12px; background: rgba(17,37,68,.08); font-size: 22px; }
.modal { position: fixed; z-index: 160; inset: 0; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(15,30,54,.28); backdrop-filter: blur(13px); }
.workflow-dialog { position: relative; width: min(760px, 100%); max-height: min(790px, calc(100vh - 40px)); overflow: auto; border-radius: 32px; }
.dialog-cover { --dialog-accent: var(--blue); position: relative; min-height: 190px; overflow: hidden; display: flex; align-items: flex-end; padding: 27px; color: white; background: linear-gradient(135deg, color-mix(in srgb, var(--dialog-accent) 82%, #081638), color-mix(in srgb, var(--dialog-accent) 55%, #84e5ef)); }
.dialog-cover-art { position: absolute; inset: 0; overflow: hidden; }
.dialog-cover-art i { position: absolute; display: block; border-radius: 50%; background: rgba(255,255,255,.17); }
.dialog-cover-art i:nth-child(1) { width: 280px; height: 280px; right: -60px; top: -140px; }
.dialog-cover-art i:nth-child(2) { width: 130px; height: 130px; right: 130px; bottom: -70px; }
.dialog-cover-art i:nth-child(3) { width: 80px; height: 80px; left: 42%; top: 24px; border: 1px solid rgba(255,255,255,.25); background: transparent; }
.dialog-cover-copy { position: relative; max-width: 75%; }
.dialog-cover .kicker { color: rgba(255,255,255,.72); }
.dialog-cover h2 { margin: 0; font-size: 34px; line-height: 1; letter-spacing: -.05em; }
.dialog-cover p:not(.kicker) { margin: 9px 0 0; color: rgba(255,255,255,.78); font-size: 11px; }
.dialog-cover .drawer-close { position: absolute; top: 17px; right: 17px; color: white; background: rgba(255,255,255,.14); }

/* 2026-08-28 workflow covers, dark theme and AI assistant presentation */
.dialog-cover.has-cover {
  background-image:
    linear-gradient(90deg, rgba(5,17,42,.84) 0%, rgba(5,17,42,.56) 48%, rgba(5,17,42,.18) 100%),
    linear-gradient(180deg, transparent 36%, rgba(4,15,36,.64) 100%),
    var(--workflow-cover);
  background-size: cover;
  background-position: center;
}
.dialog-cover.has-cover .dialog-cover-art { display: none; }
.dialog-cover.has-cover .dialog-cover-copy { max-width: min(610px, 82%); text-shadow: 0 2px 18px rgba(0,0,0,.34); }
.ai-header-button img { width: 24px; height: 24px; border-radius: 8px; object-fit: cover; }
.ai-floating-button img { width: 30px; height: 30px; border-radius: 10px; object-fit: cover; box-shadow: 0 6px 14px rgba(82,54,0,.16); }
.ai-agent-mark { padding: 0; overflow: hidden; }
.ai-agent-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.theme-toggle-button span { font-size: 17px; line-height: 1; }
.ai-panel-header { grid-template-columns: 46px minmax(0,1fr) auto auto auto 38px; }
.ai-fullscreen-toggle {
  width: 34px; height: 34px; border: 0; border-radius: 10px; display: grid; place-items: center;
  color: #315181; background: rgba(35,92,246,.08); cursor: pointer; font-size: 16px;
}
.ai-fullscreen-toggle:hover, .ai-fullscreen-toggle:focus-visible { color: #fff; background: var(--blue); }
.ai-panel.is-fullscreen { inset: 0; width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
.ai-panel.is-fullscreen .ai-panel-shell { grid-template-columns: 280px minmax(0,1fr); }
.ai-panel.is-fullscreen.is-history-collapsed .ai-panel-shell { grid-template-columns: minmax(0,1fr); }
.ai-panel.is-fullscreen .ai-conversation { max-width: 1180px; width: 100%; margin: 0 auto; }

body.theme-dark {
  color-scheme: dark;
  --ink: #eef4ff;
  --muted: #a8b6ca;
  --glass: rgba(13,22,38,.72);
  --glass-strong: rgba(16,27,46,.88);
  --glass-line: rgba(169,195,231,.16);
  --shadow: 0 26px 70px rgba(0,0,0,.38), 0 3px 14px rgba(0,0,0,.24);
  --product-nav-bg: rgba(13,23,40,.82);
  --product-nav-text: #b1c1d7;
  --product-nav-active-bg: rgba(82,138,255,.25);
  --product-nav-active-text: #f3f7ff;
  --product-nav-hover-bg: rgba(255,255,255,.08);
  --product-nav-hover-text: #fff;
  --product-nav-border: rgba(184,207,238,.14);
  --product-nav-shadow: 0 14px 34px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.06);
}
body.theme-dark .wallpaper::after { background: linear-gradient(120deg, rgba(2,8,20,.68), rgba(5,12,28,.48) 46%, rgba(8,16,36,.7)); }
body.theme-dark .page-vignette { background: radial-gradient(circle at center, rgba(4,12,28,.1) 20%, rgba(2,7,18,.72)); }
body.theme-dark .glass { box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.06); }
body.theme-dark .menubar,
body.theme-dark .workspace,
body.theme-dark .task-monitor { background: rgba(11,20,36,.72); border-color: rgba(175,201,235,.14); }
body.theme-dark .brand-type strong,
body.theme-dark .workspace-heading h1,
body.theme-dark .panel-heading h2,
body.theme-dark .workflow-card h3,
body.theme-dark .task-details em { color: var(--ink); }
body.theme-dark .search-box,
body.theme-dark .quiet-button,
body.theme-dark .icon-button,
body.theme-dark .text-button { color: #dbe7f7; background: rgba(255,255,255,.07); border-color: rgba(183,205,235,.13); }
body.theme-dark .search-box input { color: #eef4ff; }
body.theme-dark .workflow-card { border-color: rgba(190,211,239,.18); box-shadow: 0 18px 44px rgba(0,0,0,.26), inset 0 1px rgba(255,255,255,.06); }
body.theme-dark .workflow-card:has(.card-art.has-cover) .card-copy { color: #eff5ff; background: rgba(10,20,38,.76); box-shadow: 0 14px 34px rgba(0,0,0,.28); }
body.theme-dark .workflow-card .card-copy h3,
body.theme-dark .workflow-card .card-number { color: #f4f8ff; }
body.theme-dark .workflow-card .card-metric { color: #c6d4e7; background: rgba(255,255,255,.08); }
body.theme-dark .card-open { color: #f3f8ff; background: rgba(10,21,40,.68); }
body.theme-dark .task-item { border-color: rgba(176,201,232,.12); background: rgba(255,255,255,.055); }
body.theme-dark .task-item:hover,
body.theme-dark .task-item.is-expanded { border-color: rgba(82,138,255,.42); background: rgba(255,255,255,.08); }
body.theme-dark .workflow-dialog { background: rgba(12,22,39,.96); }
body.theme-dark .dialog-body,
body.theme-dark .dialog-footer { color: var(--ink); background: rgba(12,22,39,.96); border-color: rgba(176,199,229,.13); }
body.theme-dark .workflow-introduction,
body.theme-dark .schema-state,
body.theme-dark .node-field input,
body.theme-dark .node-field select,
body.theme-dark .node-field textarea,
body.theme-dark .prompt-field textarea { color: #eaf1fb; background: rgba(255,255,255,.06); border-color: rgba(183,205,235,.14); }
body.theme-dark .ai-panel { color: var(--ink); background: rgba(8,17,31,.97); border-color: rgba(185,207,235,.14); box-shadow: 0 34px 100px rgba(0,0,0,.56), inset 0 1px rgba(255,255,255,.05); }
body.theme-dark .ai-panel-header,
body.theme-dark .ai-history-rail { border-color: rgba(177,200,229,.12); background: rgba(12,23,40,.7); }
body.theme-dark .ai-panel-header small b,
body.theme-dark .ai-panel-header h2,
body.theme-dark .ai-history-item,
body.theme-dark .ai-parameter-card { color: var(--ink); }
body.theme-dark .ai-history-search,
body.theme-dark .ai-history-item,
body.theme-dark .ai-history-tabs,
body.theme-dark .ai-parameter-card,
body.theme-dark .ai-message.is-assistant > div,
body.theme-dark .ai-composer { border-color: rgba(176,200,231,.13); background: rgba(255,255,255,.055); }
body.theme-dark .ai-history-search input,
body.theme-dark .ai-input,
body.theme-dark .ai-parameter-card select,
body.theme-dark .ai-parameter-card input,
body.theme-dark .ai-parameter-card textarea { color: #eef4ff; background-color: rgba(255,255,255,.07); border-color: rgba(178,203,235,.14); }
body.theme-dark .ai-history-item:hover,
body.theme-dark .ai-history-item.is-active { background: rgba(49,94,173,.22); }
body.theme-dark .ai-parameter-card { border-color: rgba(224,176,69,.24); background: rgba(65,48,16,.34); }
body.theme-dark .ai-history-menu > div { border-color: rgba(188,208,234,.14); background: #142139; }
body.theme-dark .ai-history-menu button { color: #d6e1f0; }
body.theme-dark .account-dialog-card { color: var(--ink); background: #101d32; }

@media (max-width: 820px) {
  .ai-panel-header { grid-template-columns: 42px minmax(0,1fr) auto auto 34px 36px; }
  .ai-panel.is-fullscreen .ai-panel-shell { grid-template-columns: minmax(0,1fr); }
}
.dialog-body { padding: 23px 27px; background: rgba(250,252,255,.72); }
.workflow-form-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.workflow-form-head div { display: flex; gap: 6px; }
.workflow-form-head span { padding: 5px 8px; border-radius: 999px; color: var(--blue); background: rgba(35,92,246,.08); font-size: 9px; font-weight: 700; }
.workflow-form-head a { color: var(--blue); font-size: 9px; text-decoration: none; }
.workflow-introduction { margin-top: 16px; padding: 15px 16px; border: 1px solid rgba(87,112,160,.14); border-radius: 17px; background: rgba(255,255,255,.5); }
.introduction-heading { display: flex; align-items: baseline; gap: 9px; }
.introduction-heading small { color: var(--blue); font-size: 8px; font-weight: 800; letter-spacing: .15em; }
.introduction-heading h3 { margin: 0; font-size: 14px; }
.workflow-introduction > p { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; white-space: pre-line; }
.workflow-introduction ul { margin: 9px 0 0; padding-left: 17px; color: var(--ink); font-size: 10px; line-height: 1.7; }
.schema-state { margin-top: 18px; padding: 12px; border: 1px dashed rgba(35,92,246,.25); border-radius: 14px; color: var(--muted); background: rgba(35,92,246,.04); font-size: 10px; }
.schema-state.is-error { color: #9a3045; border-color: rgba(209,62,91,.3); background: rgba(209,62,91,.05); }
.workflow-form { display: grid; gap: 12px; margin-top: 14px; }
.node-field, .prompt-field { display: grid; gap: 6px; }
.node-field > span, .prompt-field > span { color: var(--ink); font-size: 10px; font-weight: 700; }
.node-field small, .prompt-field small { color: var(--muted); font-weight: 400; }
.node-field input, .node-field select, .node-field textarea, .prompt-field textarea { width: 100%; border: 1px solid rgba(75,100,147,.15); border-radius: 13px; padding: 11px 12px; outline: 0; color: var(--ink); background: rgba(255,255,255,.66); }
.node-field.is-ratio select { border-color: rgba(35,92,246,.24); background: rgba(244,248,255,.94); }
.model-field textarea { min-height: 112px; resize: vertical; line-height: 1.65; }
.media-upload-field { position: relative; min-height: 128px; padding: 12px; border: 1px dashed rgba(35,92,246,.32); border-radius: 18px; background: rgba(35,92,246,.035); transition: border-color .2s ease, background .2s ease, transform .2s var(--ease); }
.media-upload-field:hover, .media-upload-field.is-dragover { border-color: var(--blue); background: rgba(35,92,246,.08); transform: translateY(-2px); }
.media-upload-field > span { display: flex; justify-content: space-between; gap: 10px; }
.media-upload-field input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-placeholder { min-height: 82px; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); text-align: center; pointer-events: none; }
.upload-placeholder b { color: var(--blue); font-size: 20px; }
.upload-placeholder small { font-size: 9px; }
.upload-preview { min-height: 82px; display: grid; grid-template-columns: 72px minmax(0,1fr); align-items: center; gap: 11px; pointer-events: none; }
.upload-preview img, .upload-preview video { width: 72px; height: 72px; object-fit: cover; border-radius: 13px; background: rgba(11,24,50,.08); }
.upload-preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.upload-preview small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.prompt-field { margin-top: 14px; }
.prompt-field textarea { resize: vertical; }
.dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 27px 22px; border-top: 1px solid rgba(72,98,145,.1); background: rgba(250,252,255,.86); }
.dialog-footer p { margin: 0; color: var(--muted); font-size: 9px; }
.dialog-footer .primary-button { flex: none; }
.run-confirmation { position: sticky; z-index: 5; bottom: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 18px; padding: 16px 27px 20px; border-top: 1px solid rgba(35,92,246,.2); background: rgba(239,246,255,.97); box-shadow: 0 -18px 44px rgba(22,53,104,.15); }
.run-confirmation[hidden] { display: none; }
.run-confirmation strong { color: var(--blue-deep); font-size: 13px; }
.run-confirmation p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.run-confirmation-actions { display: flex; gap: 8px; }
.run-confirmation-actions button { min-height: 42px; border: 0; border-radius: 13px; padding: 0 17px; color: var(--muted); background: rgba(17,37,68,.08); cursor: pointer; font-weight: 750; }
.run-confirmation-actions .primary-button { color: white; background: var(--blue); }
.workflow-results { margin-top: 18px; padding-top: 17px; border-top: 1px solid rgba(72,98,145,.1); }
.results-heading { display: flex; align-items: flex-end; justify-content: space-between; }
.results-heading small { color: var(--blue); font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.results-heading h3 { margin: 2px 0 0; font-size: 18px; }
.results-heading > span { color: var(--muted); font-size: 9px; }
.result-gallery { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.result-card { position: relative; min-height: 150px; overflow: hidden; border-radius: 17px; background: rgba(11,24,50,.07); }
.result-card img, .result-card video { width: 100%; height: 100%; min-height: 150px; max-height: 280px; display: block; object-fit: contain; }
.result-card a { position: absolute; right: 8px; bottom: 8px; border-radius: 10px; padding: 7px 9px; color: #fff; background: rgba(11,24,50,.72); text-decoration: none; font-size: 9px; }

.desktop-context-menu { position: fixed; z-index: 280; width: 184px; padding: 7px; border-radius: 16px; }
.desktop-context-menu button { width: 100%; border: 0; border-radius: 10px; padding: 9px 10px; color: var(--ink); background: transparent; cursor: pointer; text-align: left; font-size: 10px; }
.desktop-context-menu button:hover { background: rgba(35,92,246,.1); color: var(--blue); }

.toast-region { position: fixed; z-index: 300; left: 50%; top: 88px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 220px; max-width: min(420px, calc(100vw - 32px)); padding: 11px 14px; border: 1px solid rgba(255,255,255,.85); border-radius: 14px; color: var(--ink); background: rgba(251,253,255,.88); box-shadow: 0 18px 45px rgba(24,45,82,.18); backdrop-filter: blur(18px); font-size: 10px; text-align: center; animation: toast-in .3s var(--ease) both; }
.toast.is-error { color: #a4233d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.97); } }
.cursor-aura { position: fixed; z-index: 290; left: 0; top: 0; width: 24px; height: 24px; border: 1px solid rgba(35,92,246,.38); border-radius: 50%; pointer-events: none; opacity: 0; transform: translate3d(-50px,-50px,0); transition: opacity .2s; }
body.has-pointer .cursor-aura { opacity: 1; }

body.is-focus .side-rail { display: none; }
body.is-focus .desktop-stage { grid-template-columns: minmax(0, 1fr); }
body.is-focus .workspace { grid-column: 1; }

@media (max-width: 1100px) {
  .workspace-actions { min-width: 0; }
  .desktop-stage { grid-template-columns: 290px minmax(0,1fr); }
  .workflow-card { width: 238px; }
  .menubar-actions .text-button { display: none; }
  .ai-header-button { display: none; }
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .creative-desktop { height: auto; min-height: 100dvh; padding: 10px; grid-template-rows: 58px minmax(0,1fr); }
  .service-state, .text-button { display: none; }
  .menubar { grid-template-columns: 1fr auto 1fr; }
  .desktop-nav a { min-width: 68px; padding: 8px 10px; font-size: 10px; }
  .mobile-only { display: grid; }
  .brand-type small { display: none; }
  .desktop-stage { display: block; }
  .workspace { min-height: calc(100dvh - 88px); border-radius: 27px; padding: 16px; }
  .workspace-heading { align-items: flex-start; flex-direction: column; }
  .workspace-actions { width: 100%; }
  .workspace-tools { width: 100%; }
  .search-box { flex: 1; width: auto; }
  .workflow-canvas { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; overflow: visible; }
  .workflow-canvas::before { display: none; }
  .workflow-card { position: relative; width: auto !important; height: 192px !important; border-radius: 22px; transform: none !important; }
  .card-resize { display: none; }
  .side-rail { display: contents; }
  .task-monitor { display: none; }
  #canvasSpacer { display: none; }
  .dialog-cover-copy { max-width: 88%; }
  .result-gallery { grid-template-columns: 1fr; }
  .ai-floating-button { right: 12px; bottom: 12px; min-height: 46px; border-radius: 15px; }
  .ai-panel { inset: 0; width: 100%; border: 0; border-radius: 0; }
  .ai-panel-header { padding-top: max(14px, env(safe-area-inset-top)); }
  .ai-panel-shell { position: relative; grid-template-columns: minmax(0,1fr); }
  .ai-panel.is-history-collapsed .ai-history-rail { display: grid; }
  .ai-history-rail {
    position: absolute; z-index: 8; inset: 0 auto 0 0; width: min(280px, 86vw);
    border-right-color: rgba(52,77,118,.13); background: rgba(237,244,251,.98);
    box-shadow: 20px 0 54px rgba(14,34,66,.2); transform: translateX(-105%); visibility: hidden;
    transition: transform .24s var(--ease), visibility .24s;
  }
  .ai-panel.is-history-open .ai-history-rail { transform: translateX(0); visibility: visible; }
  .ai-parameter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ai-model-parameter-grid { grid-template-columns: 1fr; }
  .ai-redfox-grid { grid-template-columns: 1fr; }
  .ai-redfox-upload { grid-template-columns: 34px minmax(0,1fr) auto; }
  .ai-redfox-upload [data-rf-remove] { grid-column: 3; }
}

@media (max-width: 540px) {
  .workflow-canvas { grid-template-columns: 1fr; }
  .workflow-card { height: 192px !important; }
  .workspace-heading h1 { font-size: 26px; }
  .workspace-heading p:not(.kicker), .quiet-button { display: none; }
  .menubar-actions { gap: 4px; }
  .brand-type strong { font-size: 14px; }
  .brand-type strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .menubar { grid-template-columns: auto 1fr auto; }
  .desktop-nav { justify-self: center; }
  .desktop-nav a { min-width: auto; padding: 7px 9px; }
  .desktop-nav a:first-child { display: none; }
  .repository-button { padding: 0 10px; }
  .repository-button span { display: none; }
  .workflow-dialog { max-height: calc(100dvh - 20px); border-radius: 24px; }
  .modal { padding: 10px; }
  .dialog-cover { min-height: 160px; padding: 20px; }
  .dialog-cover h2 { font-size: 27px; }
  .dialog-body, .dialog-footer { padding-left: 18px; padding-right: 18px; }
  .dialog-footer { align-items: stretch; flex-direction: column; gap: 10px; }
  .dialog-footer .primary-button { width: 100%; }
  .ai-panel-header { grid-template-columns: 42px minmax(0,1fr) auto auto 36px; padding-inline: 12px; gap: 6px; }
  .ai-agent-mark { width: 42px; height: 42px; border-radius: 14px; }
  .ai-reset-button { padding-inline: 8px; }
  .ai-history-toggle { padding-inline: 8px; font-size: 0; }
  .ai-history-toggle::after { content: "记录"; font-size: 8px; }
  .ai-material-grid, .ai-result-grid, .ai-reference-grid, .ai-generated-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 680px) {
  .menubar .brand-type { display: none; }
}

@media (pointer: coarse) { .cursor-aura { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (prefers-contrast: more) {
  .glass { background: rgba(255,255,255,.92); border-color: rgba(11,24,50,.36); }
  .workflow-card { background: rgba(255,255,255,.94); border-color: rgba(11,24,50,.28); }
}

/* 2026-08-12 macOS-style wallpaper desktop */
.workspace {
  padding: 12px 4px 4px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.workspace::before { display: none; }
.workspace-heading { padding-inline: 8px; }
.workflow-canvas {
  border-radius: 28px;
  background: transparent;
  scrollbar-color: rgba(255,255,255,.56) transparent;
}
.workflow-canvas::before { opacity: .22; }
.workflow-card {
  border: 1px solid rgba(255,255,255,.78);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 11%, rgba(255,255,255,.58)), color-mix(in srgb, var(--accent-2) 10%, rgba(235,246,255,.30)));
  box-shadow: 0 24px 62px rgba(17,36,63,.18), inset 0 1.5px 0 rgba(255,255,255,.94), inset 0 -1px 0 rgba(255,255,255,.24);
  -webkit-backdrop-filter: blur(30px) saturate(1.52);
  backdrop-filter: blur(30px) saturate(1.52);
  transition: opacity .2s ease, border-color .2s ease;
  contain: layout paint style;
}
.workflow-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 1;
  border-radius: calc(24px - 1px);
  pointer-events: none;
  background:
    radial-gradient(ellipse at 13% -8%, rgba(255,255,255,.82) 0 13%, rgba(255,255,255,.22) 34%, transparent 58%),
    linear-gradient(118deg, rgba(255,255,255,.22), transparent 38% 68%, rgba(255,255,255,.12));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
}
.workflow-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: 0 32px 70px rgba(16,35,65,.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.workflow-card:hover::after,
.workflow-card.is-dragging::after { opacity: 1; }
.workflow-card:hover,
.workflow-card.is-dragging { box-shadow: 0 22px 54px rgba(17,36,63,.16), inset 0 1px 0 rgba(255,255,255,.82); }
.card-art {
  z-index: 0;
  background:
    radial-gradient(circle at 88% 5%, color-mix(in srgb, var(--accent-2) 58%, rgba(255,255,255,.2)) 0 22%, transparent 23%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 11%, rgba(255,255,255,.28)), rgba(255,255,255,.055));
}
.card-art span { border: 0; background: linear-gradient(130deg, rgba(255,255,255,.19), transparent 52%); }
.card-art i:nth-child(3), .card-art i:nth-child(4) { opacity: .45; box-shadow: none; }
.card-copy {
  z-index: 2;
  inset: auto 14px 14px;
  border: 1px solid rgba(255,255,255,.66);
  background: linear-gradient(135deg, rgba(252,254,255,.72), rgba(235,245,255,.42));
  box-shadow: 0 12px 30px rgba(21,45,88,.12), inset 0 1px 0 rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(26px) saturate(1.42);
  backdrop-filter: blur(26px) saturate(1.42);
}
.card-open { border: 1px solid rgba(255,255,255,.72); background: rgba(248,252,255,.58); box-shadow: 0 8px 22px rgba(18,43,77,.1), inset 0 1px rgba(255,255,255,.86); -webkit-backdrop-filter: blur(18px) saturate(1.35); backdrop-filter: blur(18px) saturate(1.35); }
.card-copy h3 { font-size: clamp(14px, 1vw, 17px); font-weight: 820; }
.card-copy p { color: color-mix(in srgb, var(--ink) 54%, transparent); }
.card-metrics { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.card-metric {
  height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: 999px;
  color: color-mix(in srgb, var(--accent) 78%, #07152e);
  background: color-mix(in srgb, var(--accent) 10%, rgba(255,255,255,.68));
  font-size: 8px;
  font-weight: 800;
}
.metric-bars { height: 10px; display: inline-flex; align-items: flex-end; gap: 2px; }
.metric-bars i { width: 2px; border-radius: 2px; background: currentColor; }
.metric-bars i:nth-child(1) { height: 4px; }
.metric-bars i:nth-child(2) { height: 7px; }
.metric-bars i:nth-child(3) { height: 10px; }
.metric-orbit { position: relative; width: 11px; height: 11px; border: 1px solid currentColor; border-radius: 50%; }
.metric-orbit::after { content:""; position:absolute; width:3px; height:3px; right:-2px; top:1px; border-radius:50%; background:currentColor; }
.metric-group { color: color-mix(in srgb, var(--accent-2) 65%, #17304f); }

.task-result-strip { display:flex; gap:6px; margin-top:9px; overflow-x:auto; }
.task-result-thumb {
  position:relative;
  flex:none;
  width:56px;
  height:56px;
  padding:0;
  overflow:hidden;
  border:0;
  border-radius:12px;
  background:rgba(11,24,50,.08);
  cursor:zoom-in;
}
.task-result-thumb img,
.task-result-thumb video { width:100%; height:100%; display:block; object-fit:cover; pointer-events:none; }
.task-result-thumb span { position:absolute; right:3px; bottom:3px; min-width:16px; height:16px; display:grid; place-items:center; border-radius:6px; color:#fff; background:rgba(11,24,50,.72); font-size:7px; }
.result-card { cursor:zoom-in; }
.result-card-actions { position:absolute; right:8px; bottom:8px; display:flex; gap:5px; }
.result-card-actions button,
.result-card-actions a { position:static; border:0; border-radius:10px; padding:7px 9px; color:#fff; background:rgba(11,24,50,.74); text-decoration:none; font-size:9px; cursor:pointer; }

.media-preview { position:fixed; z-index:310; inset:0; display:grid; place-items:center; padding:18px; }
.media-preview-backdrop { position:absolute; inset:0; width:100%; border:0; background:rgba(4,10,20,.66); backdrop-filter:blur(14px); }
.media-preview-shell { position:relative; width:min(1380px,100%); height:min(900px,calc(100dvh - 36px)); display:grid; grid-template-rows:auto minmax(0,1fr) auto; border:1px solid rgba(255,255,255,.18); border-radius:28px; overflow:hidden; color:#fff; background:rgba(8,16,30,.92); box-shadow:0 38px 110px rgba(0,0,0,.42); }
.media-preview-head { display:grid; grid-template-columns:minmax(180px,1fr) auto auto 38px; align-items:center; gap:14px; padding:12px 14px; background:rgba(255,255,255,.055); }
.media-preview-head div { display:grid; gap:2px; }
.media-preview-head small { color:#85aaff; font-size:8px; letter-spacing:.18em; font-weight:800; }
.media-preview-head strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
.media-preview-head > span { color:rgba(255,255,255,.64); font-size:10px; font-variant-numeric:tabular-nums; }
.media-preview-head .drawer-close { color:#fff; background:rgba(255,255,255,.1); }
.media-preview-toolbar { display:flex !important; grid-auto-flow:column; align-items:center; gap:4px; }
.media-preview-toolbar button { width:32px; height:30px; min-height:30px; display:grid; place-items:center; border:0; border-radius:9px; padding:0; color:#fff; background:rgba(255,255,255,.08); cursor:pointer; font-size:10px; }
.media-preview-toolbar button:first-child { width:auto; padding-inline:9px; }
.media-preview-toolbar button:hover { background:rgba(255,255,255,.16); }
.media-preview-toolbar span { min-width:45px; color:rgba(255,255,255,.72); font-size:9px; text-align:center; font-variant-numeric:tabular-nums; }
.media-preview-main { min-height:0; display:grid; grid-template-rows:minmax(0,1fr) auto; overflow:hidden; background:#0b1424; }
.media-preview-viewport { position:relative; min-height:0; overflow:hidden; outline:none; touch-action:none; cursor:grab; background:radial-gradient(circle at center,rgba(56,78,111,.18),transparent 55%),#0b1424; }
.media-preview-viewport.is-panning { cursor:grabbing; }
.media-preview-stage { position:absolute; left:50%; top:50%; display:grid; place-items:center; transform:translate3d(calc(-50% + var(--pan-x,0px)),calc(-50% + var(--pan-y,0px)),0) scale(var(--media-scale,1)) rotate(var(--media-rotate,0deg)); transform-origin:center; transition:transform .18s cubic-bezier(.2,.8,.2,1); }
.media-preview-viewport.is-panning .media-preview-stage,
.media-preview-viewport.is-zooming .media-preview-stage { transition:none; will-change:transform; }
.media-preview-stage img { display:block; max-width:none; max-height:none; user-select:none; -webkit-user-drag:none; box-shadow:0 18px 48px rgba(0,0,0,.28); }
.media-preview-stage video { display:block; max-width:min(1000px,calc(100vw - 140px)); max-height:calc(100dvh - 210px); object-fit:contain; border-radius:12px; box-shadow:0 18px 48px rgba(0,0,0,.28); }
.media-preview-loading { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); color:rgba(255,255,255,.72); font-size:11px; pointer-events:none; }
.media-preview-loading[hidden] { display:none; }
.media-preview-hint { position:absolute; left:50%; bottom:18px; z-index:3; display:flex; align-items:center; gap:6px; padding:7px 9px; border:1px solid rgba(255,255,255,.12); border-radius:999px; color:rgba(255,255,255,.72); background:rgba(10,22,39,.62); box-shadow:0 10px 28px rgba(0,0,0,.2); font-size:9px; pointer-events:none; transform:translateX(-50%); -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px); transition:opacity .2s ease, transform .2s ease; }
.media-preview-hint span + span::before { content:"·"; margin-right:6px; color:rgba(255,255,255,.35); }
.media-preview-hint.is-dismissed { opacity:0; transform:translateX(-50%) translateY(5px); }
.media-preview-thumbs { min-height:0; display:flex; justify-content:center; gap:8px; padding:9px 64px; overflow-x:auto; background:rgba(255,255,255,.035); }
.media-preview-thumb { position:relative; width:52px; height:52px; flex:0 0 auto; overflow:hidden; border:2px solid transparent; border-radius:10px; padding:0; background:rgba(255,255,255,.07); cursor:pointer; opacity:.62; }
.media-preview-thumb.is-active { border-color:var(--blue); opacity:1; }
.media-preview-thumb img,.media-preview-thumb video { width:100%; height:100%; display:block; object-fit:cover; pointer-events:none; }
.media-preview-nav { position:absolute; top:50%; width:44px; height:58px; border:0; border-radius:15px; color:#fff; background:rgba(255,255,255,.1); cursor:pointer; font-size:30px; transform:translateY(-50%); }
.media-preview-nav:hover { background:rgba(255,255,255,.2); }
.media-preview-nav.prev { left:14px; }
.media-preview-nav.next { right:14px; }
.media-preview-actions { min-height:60px; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 14px; background:rgba(255,255,255,.055); }
.media-preview-actions > div { display:flex; justify-content:flex-end; gap:8px; }
.media-preview-meta { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:rgba(255,255,255,.55); font-size:9px; }
.media-action { min-height:38px; display:inline-flex; align-items:center; justify-content:center; border:1px solid rgba(255,255,255,.16); border-radius:12px; padding:0 14px; color:#fff; background:rgba(255,255,255,.08); text-decoration:none; cursor:pointer; font-size:10px; font-weight:700; }
.media-action.primary { border-color:transparent; background:var(--blue); }
.media-action:disabled { opacity:.45; cursor:wait; }

@media (max-width: 820px) {
  .workspace { padding-inline:0; }
  .media-preview { padding:8px; }
  .media-preview-shell { height:calc(100dvh - 16px); border-radius:22px; }
  .media-preview-head { grid-template-columns:minmax(0,1fr) auto 36px; }
  .media-preview-toolbar { grid-row:2; grid-column:1 / -1; justify-content:center; }
  .media-preview-actions { align-items:stretch; flex-direction:column; }
  .media-preview-actions > div { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
  .media-preview-thumbs { justify-content:flex-start; padding-inline:48px; }
}

/* 2026-08-25 account credits, admin entry and workbook-mapped covers */
.account-profile-button,.admin-entry{height:40px;border:1px solid rgba(50,83,139,.13);border-radius:14px;padding:0 10px;display:flex;align-items:center;gap:8px;color:var(--ink);background:rgba(255,255,255,.58);text-decoration:none;cursor:pointer;-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);transition:transform .16s var(--ease),background-color .16s ease,border-color .16s ease,box-shadow .16s ease}
.account-profile-button:hover{transform:translateY(-1px);border-color:rgba(35,92,246,.24);background:rgba(255,255,255,.78);box-shadow:0 8px 22px rgba(31,63,116,.1)}.account-profile-button:active{transform:translateY(0) scale(.98)}
.account-profile-avatar{width:28px;height:28px;flex:0 0 28px;border-radius:9px;display:grid;place-items:center;overflow:hidden;color:#fff;background:linear-gradient(145deg,#5a8dff,#245bd8);box-shadow:0 5px 12px rgba(36,91,216,.2)}.account-profile-avatar img{width:100%;height:100%;object-fit:cover}.account-profile-avatar b{font-size:11px;font-weight:900}.account-profile-copy{min-width:0;display:grid;gap:0;text-align:left}.account-profile-copy small{color:var(--muted);font-size:7px;line-height:1.1}.account-profile-copy strong{max-width:92px;overflow:hidden;color:var(--ink);font-size:10px;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}.admin-entry{color:#845e0e;background:rgba(255,224,120,.55);font-size:9px;font-weight:850}
.admin-entry[hidden]{display:none!important}
.account-dialog{width:min(580px,calc(100% - 30px));padding:0;border:0;border-radius:28px;background:transparent}.account-dialog::backdrop{background:rgba(7,20,41,.45);backdrop-filter:blur(8px)}.account-dialog-card{position:relative;padding:28px;border:1px solid rgba(255,255,255,.82);border-radius:28px;color:var(--ink);background:rgba(244,249,255,.97);box-shadow:0 36px 100px rgba(14,36,72,.36)}.account-dialog-card h2{margin:0;font-size:26px;letter-spacing:-.04em}.account-dialog-card>p:not(.kicker){margin:4px 0 18px;color:var(--muted)}.account-credit-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.account-credit-grid article{padding:13px;border:1px solid rgba(51,86,145,.1);border-radius:15px;display:grid;background:rgba(255,255,255,.62)}.account-credit-grid span,.account-price-note{color:var(--muted);font-size:9px}.account-credit-grid strong{font-size:18px}.account-price-note{display:flex;gap:7px;flex-wrap:wrap;margin:10px 0 18px}.account-price-note span{padding:5px 8px;border-radius:999px;background:rgba(35,92,246,.07)}.account-dialog-card details{padding:13px;border:1px solid rgba(51,86,145,.12);border-radius:16px;background:rgba(255,255,255,.45)}.account-dialog-card summary{cursor:pointer;font-size:10px;font-weight:800}.account-dialog-card details label{display:grid;gap:4px;margin-top:9px;color:var(--muted);font-size:9px}.account-dialog-card details input{height:38px;border:1px solid rgba(51,86,145,.14);border-radius:11px;padding:0 11px;color:var(--ink);background:#fff}.account-dialog-card .primary-action{width:100%;height:39px;margin-top:11px;border:0;border-radius:11px;color:#fff;background:var(--blue);font-size:10px;font-weight:850;cursor:pointer}
.workflow-card .card-art.has-cover{inset:0;width:100%;height:100%;background-image:var(--workflow-cover);background-size:cover;background-position:center}.workflow-card .card-art.has-cover::before,.workflow-card .card-art.has-cover>span,.workflow-card .card-art.has-cover>i,.workflow-card .card-art.has-cover>.card-art-icon{display:none}.workflow-card .card-art.has-cover::after{content:"";position:absolute;inset:48% 0 0;background:rgba(10,29,59,.14)}.workflow-card:has(.card-art.has-cover) .card-copy{background:rgba(240,247,255,.78);box-shadow:0 12px 34px rgba(18,42,82,.18);backdrop-filter:blur(18px) saturate(145%)}
@media(max-width:1100px){.account-profile-copy small,.admin-entry{display:none}.account-profile-copy strong{max-width:68px}.account-profile-button{padding-inline:8px}}

/* 2026-08-28 display preferences and dark workspace refinement */
.ai-history-rail {
  grid-template-rows: auto auto auto minmax(0,1fr) auto;
}
.ai-history-footer {
  padding-top: 9px;
  border-top: 1px solid rgba(65,91,134,.1);
}
.ai-display-settings-button {
  width: 100%; min-height: 50px; display: grid; grid-template-columns: 32px minmax(0,1fr) auto;
  align-items: center; gap: 9px; border: 1px solid rgba(72,102,151,.11); border-radius: 13px;
  padding: 7px 9px; color: var(--ink); background: rgba(255,255,255,.58); cursor: pointer;
  text-align: left; transition: transform .18s var(--ease), border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.ai-display-settings-button:hover {
  transform: translateY(-1px); border-color: rgba(35,92,246,.28); background: rgba(255,255,255,.84);
  box-shadow: 0 10px 24px rgba(26,55,101,.09);
}
.ai-display-settings-button > span:first-child {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px;
  color: #fff; background: linear-gradient(145deg, #3974ff, #1d4fd3); font-size: 16px;
  box-shadow: 0 7px 16px rgba(35,92,246,.22);
}
.ai-display-settings-button > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.ai-display-settings-button strong { font-size: 9px; }
.ai-display-settings-button small { overflow: hidden; color: var(--muted); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.ai-display-settings-button i { color: var(--muted); font-size: 17px; font-style: normal; }

.ai-display-settings { position: absolute; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; }
.ai-display-settings-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(7,18,35,.38); backdrop-filter: blur(10px); cursor: default; }
.ai-display-settings-card {
  position: relative; width: min(560px, 100%); max-height: calc(100dvh - 70px); display: grid;
  grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; border: 1px solid rgba(255,255,255,.86);
  border-radius: 24px; color: var(--ink); background: rgba(245,250,255,.97);
  box-shadow: 0 34px 90px rgba(15,36,72,.35), inset 0 1px rgba(255,255,255,.92);
}
.ai-display-settings-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 21px 22px 16px; border-bottom: 1px solid rgba(65,91,134,.1); }
.ai-display-settings-card > header h3 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.ai-display-settings-card > header small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.ai-display-settings-body { min-height: 0; display: grid; gap: 10px; padding: 14px 22px; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(35,92,246,.28) transparent; }
.display-setting-group { display: grid; gap: 10px; padding: 13px; border: 1px solid rgba(71,98,143,.11); border-radius: 15px; background: rgba(255,255,255,.58); }
.display-setting-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.display-setting-heading > div { display: grid; gap: 3px; }
.display-setting-heading strong { font-size: 11px; }
.display-setting-heading small { color: var(--muted); font-size: 8px; }
.display-setting-heading output { min-width: 54px; padding: 6px 9px; border-radius: 9px; color: #1e55d0; background: rgba(35,92,246,.09); font-size: 9px; font-weight: 850; text-align: center; }
.display-scale-group input[type="range"] { width: 100%; height: 5px; margin: 3px 0; accent-color: var(--blue); cursor: pointer; }
.display-scale-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 7px; }
.display-segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(25,48,86,.055); }
.display-segmented button { min-height: 34px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; font-weight: 780; transition: color .16s ease, background .16s ease, box-shadow .16s ease; }
.display-segmented button[aria-pressed="true"] { color: #fff; background: var(--blue); box-shadow: 0 7px 16px rgba(35,92,246,.22); }
.display-toggle-list { gap: 0; padding-block: 4px; }
.display-toggle-list label { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 5px; cursor: pointer; }
.display-toggle-list label + label { border-top: 1px solid rgba(71,98,143,.1); }
.display-toggle-list label > span { display: grid; gap: 3px; }
.display-toggle-list strong { font-size: 10px; }
.display-toggle-list small { color: var(--muted); font-size: 8px; }
.display-toggle-list input { appearance: none; width: 40px; height: 23px; flex: 0 0 40px; margin: 0; border: 0; border-radius: 999px; background: rgba(47,65,96,.18); cursor: pointer; transition: background .18s ease; }
.display-toggle-list input::before { content: ""; width: 17px; height: 17px; display: block; margin: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 7px rgba(18,38,72,.2); transition: transform .18s var(--ease); }
.display-toggle-list input:checked { background: var(--blue); }
.display-toggle-list input:checked::before { transform: translateX(17px); }
.ai-display-settings-card > footer { min-height: 66px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 12px 22px; border-top: 1px solid rgba(65,91,134,.1); }
.ai-display-settings-card > footer button { min-height: 38px; border: 0; border-radius: 11px; padding: 0 13px; color: #38506f; background: rgba(26,54,96,.07); cursor: pointer; font-size: 9px; font-weight: 800; }
.ai-display-settings-card > footer .primary-action { color: #fff; background: var(--blue); }
.ai-display-settings-card > footer span { color: var(--muted); font-size: 8px; text-align: center; }

body[data-creative-text-size="small"] .ai-panel { --ai-type-scale: .9; }
body[data-creative-text-size="standard"] .ai-panel { --ai-type-scale: 1; }
body[data-creative-text-size="large"] .ai-panel { --ai-type-scale: 1.14; }
.ai-panel { --ai-type-scale: 1; }
.ai-panel .ai-message > div, .ai-panel .ai-message p, .ai-panel .ai-message li,
.ai-panel .ai-parameter-card select, .ai-panel .ai-parameter-card input,
.ai-panel .ai-composer textarea, .ai-panel .ai-history-item p,
.ai-panel .ai-history-item strong { font-size: calc(9px * var(--ai-type-scale)); }
.ai-panel .ai-message > div { line-height: calc(1.62 * var(--ai-type-scale)); }
.ai-panel .ai-parameter-grid label > span, .ai-panel .ai-category-field > span,
.ai-panel .ai-tags-field span, .ai-panel .ai-history-rail small { font-size: calc(8px * var(--ai-type-scale)); }

body[data-creative-density="compact"] .ai-messages { gap: 8px; padding-block: 10px; }
body[data-creative-density="compact"] .ai-message > div { padding: 9px 11px; }
body[data-creative-density="compact"] .ai-history-list { gap: 7px; }
body[data-creative-density="compact"] .ai-history-item { padding-block: 7px; }
body[data-creative-density="spacious"] .ai-messages { gap: 17px; padding-block: 18px; }
body[data-creative-density="spacious"] .ai-message > div { padding: 14px 16px; }
body[data-creative-density="spacious"] .ai-history-list { gap: 14px; }
body[data-creative-density="spacious"] .ai-history-item { padding-block: 13px; }

body.is-display-motion-reduced *, body.is-display-motion-reduced *::before, body.is-display-motion-reduced *::after {
  scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
}
body.is-display-high-contrast { --muted: #41516b; }
body.theme-dark.is-display-high-contrast { --ink: #fff; --muted: #d2dceb; }
body.is-display-high-contrast .glass,
body.is-display-high-contrast .workflow-card,
body.is-display-high-contrast .ai-panel,
body.is-display-high-contrast .ai-display-settings-card { border-width: 2px; }

body.theme-dark .account-profile-button {
  color: #f4f8ff; border-color: rgba(139,178,235,.26);
  background: linear-gradient(145deg, rgba(37,57,86,.92), rgba(19,33,55,.88));
  box-shadow: 0 10px 24px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.08);
}
body.theme-dark .account-profile-button:hover { border-color: rgba(105,155,255,.55); background: linear-gradient(145deg, rgba(49,74,111,.96), rgba(23,40,67,.94)); box-shadow: 0 12px 30px rgba(0,0,0,.36), 0 0 0 3px rgba(70,125,246,.1); }
body.theme-dark .account-profile-copy small { color: #9fb4cf; }
body.theme-dark .account-profile-copy strong { color: #f8fbff; }
body.theme-dark .account-profile-avatar { box-shadow: 0 0 0 2px rgba(117,161,255,.26), 0 7px 16px rgba(0,0,0,.28); }
body.theme-dark .admin-entry { color: #ffe39a; border-color: rgba(243,197,86,.28); background: rgba(119,85,18,.36); }
body.theme-dark .ai-header-button { color: #201701; border-color: rgba(255,221,126,.3); box-shadow: 0 9px 22px rgba(0,0,0,.25), inset 0 1px rgba(255,255,255,.32); }
body.theme-dark .service-state { color: #baf4d4; background: rgba(40,123,83,.3); }

body.theme-dark .workspace { background: linear-gradient(180deg, rgba(10,19,34,.52), rgba(8,16,30,.34)); }
body.theme-dark .workspace-heading {
  margin: 0 7px 13px; padding: 12px 14px; align-items: center; border: 1px solid rgba(140,174,221,.12);
  border-radius: 18px; background: linear-gradient(115deg, rgba(27,45,72,.68), rgba(12,24,43,.3));
  box-shadow: inset 0 1px rgba(255,255,255,.045);
}
body.theme-dark .workspace-heading .kicker { color: #67a3ff; }
body.theme-dark .workspace-heading h1 { color: #f7faff; text-shadow: 0 4px 24px rgba(0,0,0,.25); }
body.theme-dark .workspace-heading p:not(.kicker) { color: #aebdd2; }
body.theme-dark .workflow-canvas {
  border: 1px solid rgba(129,165,215,.1); background:
    radial-gradient(circle at 18% -10%, rgba(52,99,180,.14), transparent 32%),
    linear-gradient(180deg, rgba(9,18,34,.56), rgba(8,17,31,.26));
  scrollbar-color: rgba(83,132,212,.56) rgba(8,17,31,.24);
}
body.theme-dark .workflow-canvas::before { opacity: .2; background-image: radial-gradient(circle, rgba(138,172,220,.36) 1px, transparent 1px); }
body.theme-dark .workflow-card {
  border-color: rgba(155,188,228,.24); background: linear-gradient(145deg, rgba(30,45,67,.88), rgba(18,31,50,.72));
  box-shadow: 0 22px 48px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.08);
}
body.theme-dark .workflow-card::before { background: linear-gradient(130deg, rgba(255,255,255,.08), transparent 42% 72%, rgba(85,129,202,.08)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.025); }
body.theme-dark .workflow-card:hover { border-color: rgba(101,153,255,.56); box-shadow: 0 26px 58px rgba(0,0,0,.4), 0 0 0 3px rgba(73,127,235,.08); }
body.theme-dark .workflow-card:has(.card-art.has-cover) .card-copy,
body.theme-dark .card-copy { color: #f4f8ff; border-color: rgba(178,203,235,.14); background: linear-gradient(135deg, rgba(11,22,40,.91), rgba(22,37,61,.78)); box-shadow: 0 14px 36px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.045); }
body.theme-dark .card-copy h3 { color: #f8fbff; }
body.theme-dark .card-copy p { color: #aebdd2; }
body.theme-dark .card-open { color: #f2f7ff; border-color: rgba(175,202,235,.18); background: rgba(12,25,45,.78); }
body.theme-dark .count-pill { color: #fff; border: 1px solid rgba(99,153,255,.46); background: linear-gradient(145deg, #3976ff, #1b4ac6); box-shadow: 0 8px 20px rgba(22,77,200,.34), inset 0 1px rgba(255,255,255,.2); }
body.theme-dark .task-monitor { background: linear-gradient(180deg, rgba(14,25,43,.9), rgba(10,19,34,.76)); }

body.theme-dark .workflow-canvas::-webkit-scrollbar,
body.theme-dark .task-list::-webkit-scrollbar,
body.theme-dark .ai-history-list::-webkit-scrollbar,
body.theme-dark .ai-conversation::-webkit-scrollbar,
body.theme-dark .ai-display-settings-body::-webkit-scrollbar { width: 9px; }
body.theme-dark .workflow-canvas::-webkit-scrollbar-track,
body.theme-dark .task-list::-webkit-scrollbar-track,
body.theme-dark .ai-history-list::-webkit-scrollbar-track,
body.theme-dark .ai-conversation::-webkit-scrollbar-track,
body.theme-dark .ai-display-settings-body::-webkit-scrollbar-track { background: rgba(4,12,24,.26); border-radius: 99px; }
body.theme-dark .workflow-canvas::-webkit-scrollbar-thumb,
body.theme-dark .task-list::-webkit-scrollbar-thumb,
body.theme-dark .ai-history-list::-webkit-scrollbar-thumb,
body.theme-dark .ai-conversation::-webkit-scrollbar-thumb,
body.theme-dark .ai-display-settings-body::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 99px; background: linear-gradient(#4b79c5,#315b9e) padding-box; }

body.theme-dark .ai-history-footer { border-color: rgba(167,193,228,.12); }
body.theme-dark .ai-display-settings-button { color: #edf4ff; border-color: rgba(164,191,228,.14); background: rgba(255,255,255,.055); }
body.theme-dark .ai-display-settings-button:hover { border-color: rgba(95,147,255,.38); background: rgba(71,112,184,.17); }
body.theme-dark .ai-display-settings-card { color: #eef4ff; border-color: rgba(180,204,234,.16); background: rgba(11,21,37,.98); box-shadow: 0 38px 100px rgba(0,0,0,.6), inset 0 1px rgba(255,255,255,.055); }
body.theme-dark .ai-display-settings-card > header,
body.theme-dark .ai-display-settings-card > footer,
body.theme-dark .ai-history-footer { border-color: rgba(174,199,230,.12); }
body.theme-dark .display-setting-group { border-color: rgba(176,201,232,.13); background: rgba(255,255,255,.05); }
body.theme-dark .display-setting-heading output { color: #a9c5ff; background: rgba(69,119,222,.2); }
body.theme-dark .display-segmented { background: rgba(255,255,255,.06); }
body.theme-dark .display-toggle-list label + label { border-color: rgba(177,201,232,.11); }
body.theme-dark .ai-display-settings-card > footer button { color: #d6e3f3; background: rgba(255,255,255,.07); }
body.theme-dark .ai-display-settings-card > footer .primary-action { color: #fff; background: var(--blue); }

@media (max-width: 820px) {
  .ai-display-settings { padding: 8px; }
  .ai-display-settings-card { max-height: calc(100dvh - 16px); border-radius: 20px; }
  .ai-display-settings-card > header, .ai-display-settings-card > footer { padding-inline: 15px; }
  .ai-display-settings-body { padding-inline: 15px; }
  .ai-display-settings-card > footer { grid-template-columns: 1fr 1fr; }
  .ai-display-settings-card > footer span { display: none; }
}

/* Dark assistant conversation surfaces: keep every nested state readable. */
body.theme-dark .ai-conversation {
  color: #eef4ff;
  background:
    radial-gradient(circle at 78% 4%, rgba(53,101,181,.12), transparent 32%),
    linear-gradient(180deg, rgba(7,16,30,.72), rgba(5,13,26,.56));
  scrollbar-color: rgba(83,132,212,.58) rgba(4,12,24,.28);
}
body.theme-dark .ai-message.is-assistant > .ai-message-bubble,
body.theme-dark .ai-message-bubble {
  color: #eaf2ff;
  border: 1px solid rgba(160,190,229,.15);
  background: linear-gradient(145deg, rgba(28,45,70,.96), rgba(18,32,53,.94));
  box-shadow: 0 12px 30px rgba(0,0,0,.25), inset 0 1px rgba(255,255,255,.045);
}
body.theme-dark .ai-message.is-user .ai-message-bubble {
  color: #fff;
  border-color: rgba(113,159,255,.42);
  background: linear-gradient(145deg, #3978ff, #1d4fc8);
  box-shadow: 0 12px 28px rgba(13,57,158,.34), inset 0 1px rgba(255,255,255,.14);
}
body.theme-dark .ai-message-time { color: #92a5bf; }
body.theme-dark .ai-message-bubble p,
body.theme-dark .ai-message-bubble li,
body.theme-dark .ai-message-bubble span { color: inherit; }
body.theme-dark .ai-message-bubble strong,
body.theme-dark .ai-message-bubble b { color: #f8fbff; }

body.theme-dark .ai-redfox-search {
  color: #eaf2ff;
  border-color: rgba(116,159,220,.28);
  background:
    radial-gradient(circle at 100% 0, rgba(62,111,192,.15), transparent 34%),
    linear-gradient(145deg, rgba(24,40,64,.98), rgba(15,29,49,.97));
  box-shadow: 0 18px 42px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.055);
}
body.theme-dark .ai-redfox-search header strong { color: #f8fbff; }
body.theme-dark .ai-redfox-search header small,
body.theme-dark .ai-redfox-grid label,
body.theme-dark .ai-redfox-hint { color: #aebed3; }
body.theme-dark .ai-redfox-badge {
  color: #bdf6d7;
  border: 1px solid rgba(85,213,148,.18);
  background: rgba(41,139,91,.25);
}
body.theme-dark .ai-redfox-grid select,
body.theme-dark .ai-redfox-query {
  color: #eff5ff;
  border-color: rgba(148,180,221,.2);
  background-color: rgba(8,20,37,.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}
body.theme-dark .ai-redfox-grid select:hover,
body.theme-dark .ai-redfox-query:hover { border-color: rgba(104,154,238,.42); }
body.theme-dark .ai-redfox-grid select:focus,
body.theme-dark .ai-redfox-query:focus {
  border-color: #6598f5;
  box-shadow: 0 0 0 3px rgba(68,124,230,.18), inset 0 1px rgba(255,255,255,.035);
}
body.theme-dark .ai-redfox-grid select:disabled { color: #8293aa; background-color: rgba(11,22,39,.58); }
body.theme-dark .ai-redfox-grid select option { color: #eef4ff; background: #14243b; }
body.theme-dark .ai-redfox-query::placeholder { color: #8295b0; opacity: 1; }

body.theme-dark .ai-redfox-upload {
  border-color: rgba(104,154,238,.38);
  background: rgba(7,19,36,.54);
}
body.theme-dark .ai-redfox-upload:hover,
body.theme-dark .ai-redfox-upload:focus-visible,
body.theme-dark .ai-redfox-upload.is-dragover,
body.theme-dark .ai-redfox-upload.is-active {
  border-color: rgba(109,162,255,.76);
  background: rgba(33,69,124,.28);
}
body.theme-dark .ai-redfox-upload.is-ready {
  border-color: rgba(82,211,147,.48);
  background: rgba(28,105,68,.2);
}
body.theme-dark .ai-redfox-upload-icon { color: #8eb6ff; background: rgba(67,121,222,.2); }
body.theme-dark .ai-redfox-upload strong { color: #edf4ff; }
body.theme-dark .ai-redfox-upload small { color: #9fb1c9; }
body.theme-dark .ai-redfox-upload button {
  color: #cfe0ff;
  border: 1px solid rgba(120,164,235,.16);
  background: rgba(62,111,201,.2);
}
body.theme-dark .ai-redfox-upload button:hover { background: rgba(69,126,230,.3); }
body.theme-dark .ai-redfox-upload [data-rf-remove] { color: #ffc0cb; background: rgba(201,72,96,.18); }
body.theme-dark .ai-redfox-foot button {
  box-shadow: 0 9px 22px rgba(20,68,181,.32), inset 0 1px rgba(255,255,255,.16);
}
body.theme-dark .ai-redfox-foot button:disabled { color: #aebbd0; background: rgba(68,94,137,.42); }

body.theme-dark .ai-reference-empty,
body.theme-dark .ai-integration-card,
body.theme-dark .ai-confirm-card {
  color: #dce7f6;
  border-color: rgba(137,172,219,.2);
  background: rgba(24,41,65,.88);
}
body.theme-dark .ai-reference-empty strong,
body.theme-dark .ai-integration-card header strong,
body.theme-dark .ai-confirm-card strong { color: #f6f9ff; }
body.theme-dark .ai-integration-card header small,
body.theme-dark .ai-integration-card ul,
body.theme-dark .ai-integration-card > label,
body.theme-dark .ai-confirm-card p { color: #aebdd2; }
body.theme-dark .ai-confirm-params span { color: #aebdd2; background: rgba(255,255,255,.06); }
body.theme-dark .ai-confirm-params b { color: #eff5ff; }
body.theme-dark .ai-reference-card,
body.theme-dark .ai-generated-card,
body.theme-dark .ai-material-card,
body.theme-dark .ai-result-card {
  color: #eaf2ff;
  border-color: rgba(154,187,226,.18);
  background: rgba(24,40,62,.9);
}
body.theme-dark .ai-reference-card footer strong,
body.theme-dark .ai-reference-card footer .ai-reference-title-link { color: #eef4ff; }
body.theme-dark .ai-reference-card footer span { color: #a2b3c9; }
body.theme-dark .ai-reference-more {
  color: #cfe0ff;
  border-color: rgba(111,158,229,.28);
  background: rgba(30,52,83,.86);
}
body.theme-dark .ai-reference-more:hover,
body.theme-dark .ai-reference-more:focus-visible { color: #fff; border-color: rgba(112,164,255,.58); background: rgba(43,78,132,.88); }
body.theme-dark .ai-reference-image-state { color: #aebed3; background: linear-gradient(145deg,rgba(25,41,63,.97),rgba(15,29,49,.96)); }
body.theme-dark .ai-reference-card.is-image-error .ai-reference-image-state { color: #ffd58d; background: rgba(81,58,19,.92); }
body.theme-dark .ai-reference-status.is-online,
body.theme-dark .ai-review-note { color: #bdf6d7; background: rgba(41,139,91,.24); }
body.theme-dark .ai-reference-status.is-fallback,
body.theme-dark .ai-review-note.is-warning { color: #ffdb9b; background: rgba(139,91,22,.25); }

body.theme-dark .ai-action-button,
body.theme-dark .ai-option-row button,
body.theme-dark .ai-reference-card-actions button,
body.theme-dark .ai-reference-card-actions a {
  color: #cfe0ff;
  background: rgba(65,113,200,.2);
}
body.theme-dark .ai-action-button.is-primary,
body.theme-dark .ai-reference-card-actions .ai-reference-source-link { color: #fff; background: var(--blue); }
body.theme-dark .ai-action-button.is-danger { color: #ffc0cb; background: rgba(201,72,96,.18); }

body.theme-dark .ai-composer { background: rgba(10,21,37,.92); }
body.theme-dark .ai-input::placeholder { color: #8295b0; opacity: 1; }
body.theme-dark .ai-attachment-chip { color: #dce8f8; border-color: rgba(142,177,222,.17); background: rgba(255,255,255,.06); }

body.theme-dark.is-display-high-contrast .ai-message-bubble,
body.theme-dark.is-display-high-contrast .ai-redfox-search,
body.theme-dark.is-display-high-contrast .ai-redfox-grid select,
body.theme-dark.is-display-high-contrast .ai-redfox-query,
body.theme-dark.is-display-high-contrast .ai-redfox-upload { border-color: rgba(220,233,250,.62); }
/* Dark assistant system pass: complete interactive surface coverage. */
body.theme-dark .ai-panel {
  --ai-dark-text: #f4f7fc;
  --ai-dark-text-soft: #c5d1e2;
  --ai-dark-text-muted: #9eafc6;
  --ai-dark-surface: #15243a;
  --ai-dark-surface-raised: #1b2c45;
  --ai-dark-surface-soft: rgba(33,50,75,.82);
  --ai-dark-field: #101d30;
  --ai-dark-line: rgba(166,194,230,.2);
  --ai-dark-line-strong: rgba(118,164,235,.48);
  --ai-dark-hover: rgba(71,116,190,.24);
  --ai-dark-focus: #79a7ff;
  color: var(--ai-dark-text);
}

body.theme-dark .ai-panel-header {
  background: linear-gradient(180deg, rgba(14,27,46,.98), rgba(10,21,37,.94));
  box-shadow: 0 1px rgba(255,255,255,.035), 0 12px 36px rgba(0,0,0,.16);
}
body.theme-dark .ai-panel-header .kicker { color: #f1c75f; }
body.theme-dark .ai-panel-header small { color: var(--ai-dark-text-soft); }
body.theme-dark .ai-panel-header small b { color: #fff; }
body.theme-dark .ai-history-toggle,
body.theme-dark .ai-reset-button,
body.theme-dark .ai-fullscreen-toggle,
body.theme-dark .ai-panel-header .drawer-close {
  color: #d9e6f7;
  border: 1px solid var(--ai-dark-line);
  background: rgba(40,61,89,.8);
  box-shadow: inset 0 1px rgba(255,255,255,.045);
}
body.theme-dark .ai-history-toggle:hover,
body.theme-dark .ai-reset-button:hover,
body.theme-dark .ai-fullscreen-toggle:hover,
body.theme-dark .ai-panel-header .drawer-close:hover {
  color: #fff;
  border-color: var(--ai-dark-line-strong);
  background: var(--ai-dark-hover);
}

body.theme-dark .ai-history-rail {
  color: var(--ai-dark-text);
  background: linear-gradient(180deg, rgba(15,28,47,.98), rgba(10,21,37,.96));
}
body.theme-dark .ai-history-rail > header strong { color: #f8fbff; }
body.theme-dark .ai-history-rail > header small,
body.theme-dark .ai-history-group h3 { color: var(--ai-dark-text-muted); }
body.theme-dark .ai-history-search {
  border-color: var(--ai-dark-line);
  background: var(--ai-dark-field);
}
body.theme-dark .ai-history-search span { color: #a9bdd7; }
body.theme-dark .ai-history-search input { color: var(--ai-dark-text); background: transparent; }
body.theme-dark .ai-history-search input::placeholder { color: #8fa2bc; opacity: 1; }
body.theme-dark .ai-history-tabs { border: 1px solid rgba(157,187,225,.11); background: rgba(6,15,28,.46); }
body.theme-dark .ai-history-tabs button { color: #b4c3d7; }
body.theme-dark .ai-history-tabs button:hover { color: #eef5ff; background: rgba(80,122,189,.16); }
body.theme-dark .ai-history-tabs button.is-active {
  color: #fff;
  background: linear-gradient(145deg, #3978ff, #2556ca);
  box-shadow: 0 8px 18px rgba(13,58,164,.3), inset 0 1px rgba(255,255,255,.13);
}
body.theme-dark .ai-history-tabs button span { color: #c3d1e3; background: rgba(255,255,255,.08); }
body.theme-dark .ai-history-tabs button.is-active span { color: #1c4dbd; background: #fff; }
body.theme-dark .ai-history-empty { color: var(--ai-dark-text-muted); }
body.theme-dark .ai-history-empty strong { color: var(--ai-dark-text); }
body.theme-dark .ai-history-item {
  color: var(--ai-dark-text);
  border-color: rgba(151,182,222,.17);
  background: rgba(28,45,69,.76);
}
body.theme-dark .ai-history-item:hover { border-color: rgba(111,159,234,.4); background: rgba(38,62,96,.9); }
body.theme-dark .ai-history-item.is-active {
  border-color: rgba(105,155,245,.62);
  background: linear-gradient(145deg, rgba(43,77,133,.92), rgba(29,51,85,.96));
  box-shadow: inset 3px 0 #4f86ff, 0 10px 24px rgba(0,0,0,.16);
}
body.theme-dark .ai-history-item strong { color: #f5f8fd; }
body.theme-dark .ai-history-item p { color: #bac8db; }
body.theme-dark .ai-history-item small { color: #93a6bf; }
body.theme-dark .ai-history-item-title em { color: #d9e8ff; background: rgba(73,128,229,.28); }
body.theme-dark .ai-history-menu summary { color: #a9bad0; }
body.theme-dark .ai-history-menu summary:hover,
body.theme-dark .ai-history-menu[open] summary { color: #fff; background: rgba(76,124,207,.22); }
body.theme-dark .ai-history-menu > div { background: #172941; box-shadow: 0 16px 38px rgba(0,0,0,.42); }
body.theme-dark .ai-history-menu button:hover { color: #fff; background: rgba(73,126,220,.22); }
body.theme-dark .ai-display-settings-button small,
body.theme-dark .ai-display-settings-button i { color: #9fb1c9; }

body.theme-dark .ai-parameter-card {
  color: var(--ai-dark-text);
  border-color: rgba(224,177,75,.3);
  background:
    radial-gradient(circle at 96% 0, rgba(195,142,36,.11), transparent 31%),
    linear-gradient(145deg, rgba(34,34,31,.98), rgba(25,29,31,.98));
  box-shadow: 0 14px 34px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.035);
}
body.theme-dark .ai-parameter-header strong,
body.theme-dark .ai-model-parameters header strong { color: #f8f6ee; }
body.theme-dark .ai-parameter-header small,
body.theme-dark .ai-parameter-grid label > span,
body.theme-dark .ai-category-field > span,
body.theme-dark .ai-tags-field span,
body.theme-dark .ai-model-parameter-grid label span,
body.theme-dark .ai-model-parameters header small,
body.theme-dark .ai-parameter-footer span { color: #c2c5c4; }
body.theme-dark .ai-parameter-toggle { border: 1px solid rgba(236,211,159,.1); background: rgba(4,8,12,.34); }
body.theme-dark .ai-parameter-toggle button { color: #c3c8cf; }
body.theme-dark .ai-parameter-toggle button:hover { color: #fff; background: rgba(255,255,255,.07); }
body.theme-dark .ai-parameter-toggle button[aria-pressed="true"] { color: #fff; background: linear-gradient(145deg, #3978ff, #2455ca); }
body.theme-dark .ai-category-trigger,
body.theme-dark .ai-parameter-grid select,
body.theme-dark .ai-tags-field input,
body.theme-dark .ai-model-parameter-grid select {
  color: #f4f7fb;
  border-color: rgba(164,184,209,.24);
  background: #252a2f;
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
body.theme-dark .ai-category-trigger:hover,
body.theme-dark .ai-parameter-grid select:hover,
body.theme-dark .ai-tags-field input:hover,
body.theme-dark .ai-model-parameter-grid select:hover { border-color: rgba(121,167,255,.46); background: #2a3037; }
body.theme-dark .ai-category-trigger:focus-visible,
body.theme-dark .ai-parameter-grid select:focus,
body.theme-dark .ai-tags-field input:focus,
body.theme-dark .ai-model-parameter-grid select:focus {
  border-color: var(--ai-dark-focus);
  box-shadow: 0 0 0 3px rgba(75,132,239,.2);
}
body.theme-dark .ai-category-trigger i { color: #afbdd0; }
body.theme-dark .ai-parameter-grid select option,
body.theme-dark .ai-model-parameter-grid select option { color: #f4f7fb; background: #202932; }
body.theme-dark .ai-tags-field input::placeholder { color: #929da9; opacity: 1; }
body.theme-dark .ai-category-menu {
  color: var(--ai-dark-text);
  border-color: var(--ai-dark-line);
  background: #18283e;
  box-shadow: 0 22px 54px rgba(0,0,0,.48);
}
body.theme-dark .ai-category-menu section + section { border-color: rgba(163,190,224,.13); }
body.theme-dark .ai-category-menu section > strong { color: #f5f8fc; }
body.theme-dark .ai-category-menu label { color: #d5dfed; background: rgba(71,113,181,.12); }
body.theme-dark .ai-category-menu label:hover { color: #fff; background: rgba(74,126,216,.24); }
body.theme-dark .ai-color-control input[type="color"] { border-color: var(--ai-dark-line); background: #222b35; }
body.theme-dark .ai-color-control output { color: #b8c7da; }
body.theme-dark .ai-model-parameters { border-color: rgba(99,149,232,.24); background: rgba(24,43,70,.68); }
body.theme-dark .ai-parameter-footer { border-color: rgba(225,184,93,.16); background: rgba(6,9,12,.12); }

body.theme-dark .ai-conversation { color: var(--ai-dark-text); }
body.theme-dark .ai-messages { scrollbar-color: rgba(83,132,212,.58) rgba(4,12,24,.28); }
body.theme-dark .ai-message.is-assistant > .ai-message-bubble { background: linear-gradient(145deg, #1e314c, #16263d); }
body.theme-dark .ai-message-time { color: #a4b5cb; }
body.theme-dark .ai-option-row button:hover,
body.theme-dark .ai-action-button:hover { color: #fff; background: rgba(76,132,229,.34); }
body.theme-dark .ai-action-button:disabled,
body.theme-dark .ai-option-row button:disabled { color: #98a8bd; background: rgba(72,91,121,.28); opacity: .78; }

body.theme-dark .ai-message.is-assistant > .ai-redfox-search {
  color: var(--ai-dark-text);
  border-color: rgba(115,160,230,.34);
  background:
    radial-gradient(circle at 100% 0, rgba(68,121,207,.17), transparent 36%),
    linear-gradient(145deg, #1a2c46, #13243a);
}
body.theme-dark .ai-message.is-assistant > .ai-redfox-search .ai-redfox-grid select,
body.theme-dark .ai-message.is-assistant > .ai-redfox-search .ai-redfox-query { color: #f3f7fd; background: #0f1f34; }
body.theme-dark .ai-message.is-assistant > .ai-redfox-search .ai-redfox-upload { background: rgba(9,25,45,.78); }
body.theme-dark .ai-message.is-assistant > .ai-redfox-search .ai-redfox-upload:hover,
body.theme-dark .ai-message.is-assistant > .ai-redfox-search .ai-redfox-upload:focus-visible { background: rgba(38,76,132,.42); }

body.theme-dark .ai-generated-card label,
body.theme-dark .ai-material-card label {
  color: #f2f6fc;
  border: 1px solid rgba(164,191,227,.17);
  background: rgba(13,27,45,.9);
  box-shadow: 0 5px 15px rgba(0,0,0,.24);
}
body.theme-dark .ai-material-card p,
body.theme-dark .ai-result-card footer { color: #dce6f3; }
body.theme-dark .ai-result-heading { color: #b0bfd2; }
body.theme-dark .ai-integration-card.is-connected { border-color: rgba(87,205,145,.3); background: rgba(28,86,61,.22); }
body.theme-dark .ai-integration-actions button { color: #cfe0ff; background: rgba(65,113,200,.2); }
body.theme-dark .ai-integration-actions button.is-primary { color: #fff; background: var(--blue); }

body.theme-dark .ai-composer {
  border-color: rgba(158,188,226,.18);
  background: linear-gradient(180deg, rgba(14,27,46,.97), rgba(10,21,37,.99));
  box-shadow: 0 -14px 34px rgba(0,0,0,.15);
}
body.theme-dark .ai-composer textarea {
  color: #f3f7fd;
  border-color: rgba(157,187,225,.23);
  background: #132239;
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
body.theme-dark .ai-composer textarea:hover { border-color: rgba(115,161,235,.42); }
body.theme-dark .ai-composer textarea:focus { border-color: var(--ai-dark-focus); box-shadow: 0 0 0 3px rgba(75,132,239,.2); }
body.theme-dark .ai-composer textarea::placeholder { color: #96a7be; opacity: 1; }
body.theme-dark .ai-attach-button { color: #a9c7ff; border: 1px solid rgba(133,173,235,.2); background: rgba(55,99,177,.22); }
body.theme-dark .ai-attach-button:hover { color: #fff; border-color: rgba(119,166,245,.5); background: rgba(66,119,211,.34); }
body.theme-dark .ai-quick-actions button {
  color: #f6dea0;
  border: 1px solid rgba(227,186,88,.22);
  background: rgba(126,91,24,.26);
}
body.theme-dark .ai-quick-actions button:hover,
body.theme-dark .ai-quick-actions button:focus-visible { color: #fff4d1; border-color: rgba(244,203,102,.48); background: rgba(159,112,25,.38); }

body.theme-dark .ai-panel :is(button, input, select, textarea, summary, [role="button"]):focus-visible {
  outline: 2px solid var(--ai-dark-focus);
  outline-offset: 2px;
}
body.theme-dark .ai-panel :disabled { cursor: not-allowed; }

body.theme-dark .ai-display-settings-card,
body.theme-dark .display-setting-group { color: var(--ai-dark-text); }
body.theme-dark .display-setting-heading small,
body.theme-dark .display-scale-labels,
body.theme-dark .display-toggle-list small,
body.theme-dark .ai-display-settings-card > footer span { color: var(--ai-dark-text-muted); }
body.theme-dark .display-segmented button { color: #bcc9da; }
body.theme-dark .display-segmented button:hover { color: #fff; background: rgba(75,124,207,.2); }
body.theme-dark .display-segmented button[aria-pressed="true"] { color: #fff; background: var(--blue); }

body.theme-dark.is-display-high-contrast .ai-panel {
  --ai-dark-text-soft: #e3ebf6;
  --ai-dark-text-muted: #ced9e8;
  --ai-dark-line: rgba(220,233,250,.56);
}
body.theme-dark.is-display-high-contrast .ai-history-item,
body.theme-dark.is-display-high-contrast .ai-category-trigger,
body.theme-dark.is-display-high-contrast .ai-parameter-card select,
body.theme-dark.is-display-high-contrast .ai-parameter-card input,
body.theme-dark.is-display-high-contrast .ai-composer textarea { border-width: 2px; }

@media (max-width: 820px) {
  body.theme-dark .ai-history-rail { background: #102139; }
}
