:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #17191f;
  --muted: #7b8493;
  --line: #e7e9ee;
  --line-strong: #d9dee7;
  --accent: #11a8ff;
  --accent-dark: #0b8fd9;
  --soft: #f1f7ff;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(17, 168, 255, .16), transparent 28%),
    radial-gradient(circle at 80% 20%, rgba(99, 91, 255, .14), transparent 26%),
    #f6f7f8;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .14);
}

.login-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #13c8ff, #635bff);
  font-weight: 800;
  margin-bottom: 18px;
}

.login-card h1 {
  font-size: 34px;
  margin-bottom: 18px;
}

.login-card label {
  display: grid;
  gap: 8px;
  color: #344054;
  margin-top: 14px;
}

.login-card input {
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
}

.login-card button {
  width: 100%;
  margin-top: 18px;
}

.chat-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 64px 260px minmax(0, 1fr) 360px;
}

.rail {
  border-right: 1px solid var(--line);
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 22px 10px;
}

.mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #13c8ff, #635bff);
  font-weight: 800;
  justify-self: center;
}

.rail-menu {
  align-self: center;
  display: grid;
  gap: 18px;
  justify-items: center;
}

.rail-btn {
  width: 42px;
  min-height: 54px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: grid;
  place-items: center;
  gap: 4px;
  color: #111827;
  padding: 7px 0;
}

.rail-btn span {
  font-size: 12px;
  color: #344054;
}

.rail-btn.active {
  background: #f1f5f9;
}

.side {
  position: relative;
  z-index: 30;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.work-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.work-mode {
  border: 0;
  border-radius: 9px;
  padding: 8px 6px;
  font-size: 13px;
  background: transparent;
}

.work-mode.active {
  background: var(--accent);
  color: #fff;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 18px; line-height: 1.2; }
h2 { font-size: clamp(26px, 2.4vw, 34px); letter-spacing: 0; }
p { color: var(--muted); line-height: 1.55; }

.brand-block p { margin-top: 6px; font-size: 13px; }

button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
}

button:hover { border-color: #c6ccd6; }

.new-chat {
  text-align: left;
  background: #f3f4f6;
  border: 0;
}

.session-list {
  display: grid;
  gap: 8px;
  max-height: 34vh;
  overflow: visible;
  padding-right: 2px;
}

.session-card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  color: #344054;
  font-size: 14px;
  border: 0;
  background: transparent;
  text-align: left;
}

.session-card.menu-open {
  z-index: 200;
}

.session-card.active { background: #f8fafc; }

.session-card span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-card small {
  color: var(--muted);
  font-size: 11px;
}

.session-more {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #667085;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  background: #f3f4f6;
}

.session-card:hover .session-more,
.session-card.active .session-more,
.session-card.menu-open .session-more {
  display: inline-flex;
}

.session-menu {
  display: none;
  position: absolute;
  right: 6px;
  top: 46px;
  z-index: 999;
  min-width: 150px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .14);
}

.session-card.menu-open .session-menu {
  display: grid;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: #1f2937;
  font-size: 14px;
  font-weight: 800;
}

.menu-item:hover {
  background: #f6f7f9;
}

.menu-item::before {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
}

.rename-session::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.delete-session {
  color: var(--danger);
}

.delete-session::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v5'/%3E%3Cpath d='M14 11v5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v5'/%3E%3Cpath d='M14 11v5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.session-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e5e7eb, #bcdfff);
  overflow: hidden;
  flex: 0 0 auto;
}

.session-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-spacer { flex: 1; }

.config {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  background: #fafafa;
}

.primary, .send {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.primary:hover, .send:hover { background: var(--accent-dark); }

.chat {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 100vh;
}

.messages {
  position: relative;
  height: 100vh;
  padding: 34px clamp(24px, 5vw, 76px) 210px;
  overflow: auto;
}

.welcome {
  min-height: calc(100vh - 260px);
  display: grid;
  place-content: center;
  text-align: center;
  gap: 10px;
}

.welcome p {
  max-width: 560px;
}

.bubble {
  display: grid;
  grid-template-columns: 34px minmax(0, 760px);
  gap: 12px;
  margin-bottom: 16px;
}

.bubble.user {
  grid-template-columns: minmax(0, 760px) 34px;
  justify-content: end;
}

.bubble.user .avatar { grid-column: 2; }
.bubble.user .content { grid-column: 1; grid-row: 1; background: #f5fbff; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.bubble.user .avatar { background: var(--accent); }

.content {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

.content strong { display: block; margin-bottom: 5px; }

.wide-result {
  grid-template-columns: 34px minmax(0, 1000px);
}

.result-content {
  padding: 14px;
}

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

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

.icon-danger {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #98a2b3;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: .16s ease;
}

.icon-danger::before {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v5'/%3E%3Cpath d='M14 11v5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v5'/%3E%3Cpath d='M14 11v5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.result-content:hover .result-delete,
.product-result-row:hover .product-result-delete {
  opacity: 1;
}

.icon-danger:hover {
  border-color: #fecaca;
  background: #fff1f1;
  color: var(--danger);
}

.product-result-list {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}

.product-result-row {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  padding: 14px;
}

.product-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.product-result-head h3 {
  font-size: 16px;
  line-height: 1.25;
}

.product-result-head p {
  font-size: 13px;
  margin-top: 4px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.download-btn.subtle {
  min-height: 30px;
  background: #fff;
  color: #344054;
  border: 1px solid var(--line);
}

.set-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.set-title {
  display: grid;
  gap: 8px;
  align-content: start;
}

.set-title span {
  font-weight: 700;
  font-size: 14px;
}

.chat-image-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chat-image-card {
  position: relative;
  min-width: 82px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
}

.image-open {
  display: block;
}

.chat-image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f8fafc;
}

.chat-image-card span {
  display: block;
  padding: 6px;
  text-align: center;
}

.failed-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  align-content: start;
}

.failed-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #fff1f1;
  color: var(--danger);
  font-weight: 800;
}

.failed-card small {
  min-height: 36px;
  color: #667085;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.failed-card button {
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid #ffd0d0;
  background: #fff;
  color: var(--danger);
  font-weight: 700;
}

.single-download {
  position: absolute;
  right: 6px;
  top: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: .16s ease;
  border-radius: 999px;
  background: rgba(17, 24, 39, .82);
  color: #fff;
  text-decoration: none;
  font-size: 11px;
  padding: 5px 8px;
}

.chat-image-card:hover .single-download {
  opacity: 1;
  transform: translateY(0);
}

.refs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.refs img, .thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.product-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.composer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(246,247,248,0), #f6f7f8 24%);
  padding: 10px clamp(24px, 5vw, 76px) 26px;
}

.attachment-bar {
  width: min(920px, 100%);
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.attachment-spacer {
  flex: 1 1 auto;
}

.thumb { position: relative; }

.thumb button {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  padding: 0;
  color: #fff;
  background: var(--danger);
  border: 0;
}

.style-ref-button,
.preset-style-button,
.set-count-control {
  min-height: 34px;
  border-radius: 10px;
  background: #fff;
  color: #344054;
  font-size: 12px;
}

.preset-style-button {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-count-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  padding: 4px 6px;
}

.set-count-control span {
  color: var(--muted);
  margin-right: 2px;
}

.set-count-control button {
  width: 28px;
  height: 26px;
  padding: 0;
  border-radius: 7px;
  font-size: 12px;
}

.set-count-control button.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.style-thumb::after {
  content: "";
}

.style-thumb img,
.style-ref-preview {
  border-color: #9dcfff !important;
}

.style-thumb span {
  position: absolute;
  left: 4px;
  bottom: 4px;
  border-radius: 999px;
  padding: 2px 5px;
  background: rgba(17, 168, 255, .88);
  color: #fff;
  font-size: 10px;
}

.preset-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .32);
  backdrop-filter: blur(8px);
}

.preset-modal[hidden] {
  display: none !important;
}

.preset-dialog {
  width: min(1080px, 94vw);
  max-height: min(760px, 88vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .24);
  padding: 20px;
}

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

.preset-head h3 { font-size: 24px; margin: 0 0 6px; }
.preset-head p { font-size: 13px; }

#presetClose {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
  font-size: 24px;
  line-height: 1;
}

.preset-grid {
  display: grid;
  gap: 12px;
}

.preset-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  padding: 14px;
  border-radius: 18px;
  text-align: left;
  background: #fbfdff;
  border: 1px solid var(--line);
}

.preset-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 168, 245, .12);
}

.preset-title {
  display: grid;
  align-content: center;
  gap: 6px;
}

.preset-title strong { font-size: 16px; }

.preset-title span,
.preset-card p {
  color: var(--muted);
  font-size: 12px;
}

.preset-card p {
  grid-column: 1 / -1;
  line-height: 1.45;
}

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

.preset-thumb {
  position: relative;
  display: block;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 72% 26%, rgba(255,255,255,.9) 0 12%, transparent 13%),
    linear-gradient(135deg, #f8fafc, #dbeafe);
}

.preset-thumb::before {
  content: "";
  position: absolute;
  inset: 16% 18% 30%;
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 10px 25px rgba(15,23,42,.18);
}

.preset-thumb::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 12%;
  height: 12%;
  border-radius: 999px;
  background: rgba(15, 23, 42, .22);
}

.preset-thumb span {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 5px;
  z-index: 2;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-shadow: 0 1px 6px rgba(0,0,0,.36);
  text-align: center;
}

.preset-1-0, .preset-1-1, .preset-1-2, .preset-1-3, .preset-1-4, .preset-1-5, .preset-1-6 { background: linear-gradient(135deg, #ffffff, #e5e7eb); }
.preset-2-0, .preset-2-1, .preset-2-2, .preset-2-3, .preset-2-4, .preset-2-5, .preset-2-6 { background: linear-gradient(135deg, #fef3c7, #d6b98c); }
.preset-3-0, .preset-3-1, .preset-3-2, .preset-3-3, .preset-3-4, .preset-3-5, .preset-3-6 { background: linear-gradient(135deg, #111827, #6b7280); }
.preset-4-0, .preset-4-1, .preset-4-2, .preset-4-3, .preset-4-4, .preset-4-5, .preset-4-6 { background: linear-gradient(135deg, #eff6ff, #93c5fd); }
.preset-5-0, .preset-5-1, .preset-5-2, .preset-5-3, .preset-5-4, .preset-5-5, .preset-5-6 { background: linear-gradient(135deg, #fef2f2, #f97316); }
.preset-6-0, .preset-6-1, .preset-6-2, .preset-6-3, .preset-6-4, .preset-6-5, .preset-6-6 { background: linear-gradient(135deg, #fafaf9, #a8a29e); }
.preset-7-0, .preset-7-1, .preset-7-2, .preset-7-3, .preset-7-4, .preset-7-5, .preset-7-6 { background: linear-gradient(135deg, #fff7ed, #84cc16); }
.preset-8-0, .preset-8-1, .preset-8-2, .preset-8-3, .preset-8-4, .preset-8-5, .preset-8-6 { background: linear-gradient(135deg, #ecfeff, #38bdf8); }
.preset-9-0, .preset-9-1, .preset-9-2, .preset-9-3, .preset-9-4, .preset-9-5, .preset-9-6 { background: linear-gradient(135deg, #fff1f2, #f43f5e); }
.preset-10-0, .preset-10-1, .preset-10-2, .preset-10-3, .preset-10-4, .preset-10-5, .preset-10-6 { background: linear-gradient(135deg, #ecfccb, #57534e); }

.input-row {
  width: min(920px, 100%);
  min-height: 116px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(16, 24, 40, .06);
  padding: 14px;
}

.add-tile {
  width: 58px;
  height: 72px;
  align-self: start;
  border-radius: 4px;
  border: 0;
  background: #f0f1f3;
  color: #7b8493;
  font-size: 28px;
  transform: rotate(-8deg);
}

.prompt-box {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.mode-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
}

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

.custom-options {
  display: grid;
  grid-template-columns: 150px;
  gap: 10px;
  padding-top: 2px;
}

.custom-options.compact {
  justify-content: end;
}

.custom-options[hidden] { display: none; }

.custom-options label {
  display: grid;
  gap: 5px;
  color: #667085;
  font-size: 12px;
}

.custom-options input,
.custom-options textarea,
.modal-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

.custom-options textarea {
  min-height: 42px;
  max-height: 90px;
  resize: vertical;
}

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

.stepper {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  gap: 6px;
}

.stepper button {
  padding: 0;
  height: 36px;
}

textarea {
  width: 100%;
  min-height: 58px;
  max-height: 170px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 4px 0;
  font: inherit;
  font-size: 15px;
}

.send {
  width: 42px;
  height: 42px;
  align-self: end;
  border-radius: 999px;
  padding: 0;
  font-size: 22px;
}

.run-panel {
  border-left: 1px solid var(--line);
  background: #fff;
  padding: 18px;
  overflow: auto;
}

.panel-view {
  min-height: 100vh;
  padding: 34px clamp(24px, 5vw, 76px);
  overflow: auto;
}

.panel-view-head {
  margin-bottom: 18px;
}

.panel-view-head p {
  margin-top: 6px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.asset-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.asset-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #f8fafc;
}

.asset-card span,
.asset-card small {
  display: block;
  padding: 8px 10px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-card small {
  padding: 2px 10px 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.settings-page {
  background: #f5f7fb;
}

.settings-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 860px);
  justify-content: center;
  gap: 32px;
  padding: 56px 32px;
}

.settings-nav {
  position: sticky;
  top: 32px;
  align-self: start;
  display: grid;
  gap: 8px;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 20px;
  font-size: 14px;
}

.settings-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.settings-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(24, 168, 245, .22);
}

.settings-logo img {
  width: 100%;
  height: 100%;
  display: block;
}

.settings-brand h1 {
  font-size: 22px;
}

.settings-brand p,
.section-head p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.settings-tab {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 13px 15px;
  display: grid;
  gap: 3px;
  color: #344054;
}

.settings-tab span {
  font-weight: 800;
}

.settings-tab small {
  color: #98a2b3;
  font-size: 12px;
}

.settings-tab.active {
  color: #101828;
  background: #fff;
  box-shadow: 0 12px 30px rgba(16, 24, 40, .08);
}

.settings-tab.active small {
  color: var(--muted);
}

.settings-main {
  display: grid;
}

.settings-section {
  display: none;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, .07);
}

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

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

.section-head h2 {
  font-size: 28px;
  line-height: 1.15;
}

.status-pill {
  border: 1px solid #d7ecff;
  background: #f0f9ff;
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfdff;
  padding: 18px;
}

.settings-card label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.settings-card label:first-child {
  margin-top: 0;
}

.settings-card input,
.settings-card select,
.inline-form input,
.inline-form select,
.role-select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
  background: #fff;
}

.settings-card input:focus,
.settings-card select:focus,
.inline-form input:focus,
.inline-form select:focus,
.role-select:focus {
  outline: 2px solid rgba(24, 168, 245, .16);
  border-color: var(--accent);
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.form-footer .hint {
  margin: 0;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr 130px auto;
  gap: 10px;
}

.user-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}

.role-select {
  height: 40px;
  border-radius: 12px;
  font-size: 14px;
}

.user-row span,
.empty-text {
  color: var(--muted);
  font-size: 12px;
}

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

#jobState {
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}

.run-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.cancel-job {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #ffd0d0;
  background: #fff;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.clear-job {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
  margin-bottom: 12px;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.full {
  width: 100%;
  margin-bottom: 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.result {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  background: #fff;
}

.result img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.result div { padding: 8px; overflow-wrap: anywhere; }

.logs {
  max-height: 240px;
  overflow: auto;
  border-radius: 10px;
  background: #101828;
  color: #e5e7eb;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, .28);
  backdrop-filter: blur(6px);
  padding: 20px;
}

.modal-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .18);
}

.modal-card label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: #344054;
  font-size: 14px;
}

.modal-card input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions button {
  flex: 1;
}

.hint {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .chat-shell { grid-template-columns: 64px 220px minmax(0, 1fr); }
  .run-panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .chat { min-height: calc(100vh - 360px); }
  .messages { height: calc(100vh - 360px); }
}

@media (max-width: 780px) {
  .chat-shell { display: block; }
  .rail { display: none; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .chat { min-height: 620px; }
  .messages { height: 620px; padding: 22px 18px 190px; }
  .welcome { min-height: 280px; }
  .composer { padding: 10px 16px 20px; }
  .input-row { grid-template-columns: 58px 1fr 42px; min-height: 108px; }
  .add-tile { width: 46px; height: 62px; }
  .bubble, .bubble.user { grid-template-columns: 32px minmax(0, 1fr); }
  .wide-result { grid-template-columns: 32px minmax(0, 1fr); }
  .bubble.user .avatar { grid-column: 1; }
  .bubble.user .content { grid-column: 2; }
  .set-row { grid-template-columns: 1fr; }
  .chat-image-strip { grid-template-columns: repeat(7, 88px); }
}
