.gpt-image-studio {
  color: hsl(var(--foreground));
}

.gpt-image-studio * {
  box-sizing: border-box;
}

.gis-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  gap: 1rem;
  width: 100%;
  margin: 0 auto;
  padding: 0.75rem 0 1.5rem;
  background: linear-gradient(180deg, #f7faff 0%, #ffffff 34rem);
}

.gis-main,
.gis-usage-rail,
.gis-workspace,
.gis-agent,
.gis-square,
.gis-section,
.gis-composer,
.gis-rail-card,
.gis-rule-card,
.gis-admin-overview,
.gis-admin-sticky-save {
  border: 1px solid #dfe8f7;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.06);
}

.gis-main {
  min-width: 0;
  padding: 1rem;
}

.gis-top-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e4ebf7;
}

.gis-mode-tab {
  display: inline-flex;
  min-height: 3.1rem;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid #e0e8f7;
  border-bottom: 0;
  border-radius: 0.5rem 0.5rem 0 0;
  background: #f8fbff;
  padding: 0 1.25rem;
  color: #4b5f86;
  font-size: 0.95rem;
  font-weight: 650;
  cursor: pointer;
}

.gis-mode-tab.is-active {
  border-color: #b9cdfb;
  background: #eef5ff;
  color: #0b63ff;
}

.gis-workspace {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.gis-main.is-gallery-main {
  display: flex;
  min-height: calc(100vh - 7rem);
  flex-direction: column;
  border: 0;
  background: #f7f7f8;
  box-shadow: none;
  padding: 0;
}

.gis-main.is-gallery-main .gis-top-tabs {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.75rem 0;
}

.gis-gallery-mode {
  display: flex;
  min-height: calc(100vh - 12rem);
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1rem;
}

.gis-gallery-canvas {
  position: relative;
  min-height: 28rem;
  flex: 1 1 auto;
  padding: 0.5rem 0.5rem 8rem;
}

.gis-gallery-empty {
  display: flex;
  min-height: 20rem;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  color: #9aa1ad;
  text-align: center;
}

.gis-gallery-empty svg {
  width: 3.25rem;
  height: 3.25rem;
  color: #c5cad3;
}

.gis-gallery-empty strong {
  color: #323742;
}

.gis-gallery-task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.gis-gallery-task-card {
  display: grid;
  height: 11.5rem;
  min-width: 0;
  grid-template-columns: 8.75rem minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #dcdfe5;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.gis-gallery-task-card:hover,
.gis-gallery-task-card.is-active {
  border-color: #9bbcff;
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.13);
  transform: translateY(-1px);
}

.gis-gallery-task-preview {
  position: relative;
  display: flex;
  min-height: 11.5rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #f1f2f4;
  color: #7b8494;
  text-align: center;
}

.gis-gallery-task-preview img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.gis-gallery-task-preview svg {
  width: 2.4rem;
  height: 2.4rem;
  color: #9aa3b4;
}

.gis-gallery-task-preview.is-failed {
  background: #fff5f5;
  color: #a64b4b;
}

.gis-gallery-task-preview.is-failed svg {
  color: #dc2626;
}

.gis-gallery-task-preview strong {
  color: #323742;
  font-size: 0.95rem;
}

.gis-gallery-task-preview span {
  max-width: 86%;
  overflow: hidden;
  color: inherit;
  font-size: 0.8rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gis-gallery-image-count {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  border-radius: 0.35rem;
  background: rgba(42, 42, 42, 0.68);
  color: #fff;
  padding: 0.2rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 750;
}

.gis-gallery-task-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 0.75rem;
}

.gis-gallery-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.gis-gallery-task-head time {
  color: #9aa1ad;
  font-size: 0.76rem;
  line-height: 1;
  white-space: nowrap;
}

.gis-gallery-status {
  display: inline-flex;
  min-height: 1.55rem;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #dfe4ec;
  border-radius: 999rem;
  background: #f7f8fa;
  color: #687386;
  padding: 0.15rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 750;
}

.gis-gallery-status svg {
  width: 0.85rem;
  height: 0.85rem;
  flex: 0 0 auto;
}

.gis-gallery-status span {
  white-space: nowrap;
}

.gis-gallery-status.is-pending {
  border-color: #b9cdfb;
  background: #eef5ff;
  color: #075dff;
}

.gis-gallery-status.is-success {
  border-color: #bde8cf;
  background: #f0fdf4;
  color: #15803d;
}

.gis-gallery-status.is-failed {
  border-color: #fecaca;
  background: #fff1f2;
  color: #dc2626;
}

.gis-gallery-status.is-pending svg,
.is-spinning {
  animation: gis-spin 0.9s linear infinite;
}

.gis-gallery-task-prompt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #272b33;
  margin-top: 0.4rem;
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gis-gallery-task-runtime {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.1rem;
  margin-top: 0.4rem;
  color: #8a93a3;
  font-size: 0.72rem;
  line-height: 1.35;
}

.gis-gallery-task-runtime span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gis-gallery-task-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.38rem;
  margin-top: auto;
  padding-top: 0.55rem;
}

.gis-gallery-task-actions button,
.gis-gallery-task-actions a,
.gis-gallery-detail-link {
  display: inline-flex;
  width: 1.9rem;
  height: 1.9rem;
  flex: 0 0 1.9rem;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e5eb;
  border-radius: 0.45rem;
  background: #fff;
  color: #7d8795;
  cursor: pointer;
  text-decoration: none;
}

.gis-gallery-task-actions button:hover,
.gis-gallery-task-actions a:hover,
.gis-gallery-detail-link:hover {
  border-color: #b9cdfb;
  background: #eef5ff;
  color: #3b82f6;
}

.gis-gallery-task-actions .is-primary {
  border-color: #3b82f6;
  background: #3b82f6;
  color: #fff;
}

.gis-gallery-job-dialog {
  max-height: 88vh;
  overflow: auto;
}

.gis-gallery-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 1rem;
  align-items: start;
}

.gis-gallery-detail-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.85rem;
}

.gis-gallery-detail-image {
  margin: 0;
  overflow: hidden;
  border: 1px solid #e2e6ee;
  border-radius: 0.65rem;
  background: #fff;
}

.gis-gallery-detail-image img {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  background: #f4f5f7;
}

.gis-gallery-detail-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.75rem;
}

.gis-gallery-detail-link {
  width: auto;
  padding: 0 0.75rem;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 650;
}

.gis-gallery-detail-meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.9rem;
  border: 1px solid #e2e6ee;
  border-radius: 0.65rem;
  background: #fbfcff;
  padding: 1rem;
}

.gis-gallery-detail-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.gis-gallery-detail-block > span,
.gis-gallery-detail-grid span {
  color: #8a93a3;
  font-size: 0.78rem;
  font-weight: 750;
}

.gis-gallery-detail-block p {
  margin: 0;
  color: #272b33;
  font-size: 0.95rem;
  line-height: 1.65;
}

.gis-gallery-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.gis-gallery-detail-grid > div {
  min-width: 0;
  border: 1px solid #e5e8ef;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.65rem;
}

.gis-gallery-detail-grid strong {
  display: block;
  margin-top: 0.25rem;
  overflow: hidden;
  color: #2f3642;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gis-gallery-detail-error {
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  background: #fff1f2;
  color: #b91c1c;
  padding: 0.75rem;
  font-size: 0.88rem;
  line-height: 1.55;
}

.gis-gallery-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.gis-gallery-detail-actions button {
  justify-content: center;
}

.gis-gallery-detail-empty {
  display: flex;
  min-height: 26rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1px dashed #d8dee9;
  border-radius: 0.65rem;
  background: #f7f8fb;
  color: #7c8796;
  text-align: center;
}

.gis-gallery-detail-empty.is-failed {
  border-color: #fecaca;
  background: #fff5f5;
  color: #a64b4b;
}

.gis-gallery-detail-empty svg {
  width: 2.7rem;
  height: 2.7rem;
}

@keyframes gis-spin {
  to {
    transform: rotate(360deg);
  }
}

.gis-gallery-composer-panel {
  position: sticky;
  bottom: 0.75rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  width: min(100%, 78rem);
  margin: auto auto 0;
  border: 1px solid #dfe2e8;
  border-radius: 1.55rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.13);
  padding: 1rem 1.2rem;
}

.gis-gallery-refs {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.gis-gallery-ref-thumb {
  position: relative;
  width: 4.4rem;
  height: 4.4rem;
  overflow: hidden;
  border: 1px solid #e4e7ed;
  border-radius: 0.85rem;
  background: #fff;
  padding: 0;
  cursor: pointer;
}

.gis-gallery-ref-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gis-gallery-ref-thumb span {
  position: absolute;
  left: 0.35rem;
  bottom: 0.35rem;
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border-radius: 999rem;
  background: rgba(56, 56, 56, 0.78);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 750;
}

.gis-gallery-ref-clear {
  display: flex;
  width: 4.4rem;
  height: 4.4rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: 1px dashed #d7dbe3;
  border-radius: 0.85rem;
  background: #fff;
  color: #9aa1ad;
  font-size: 0.78rem;
  cursor: pointer;
}

.gis-gallery-prompt-line {
  position: relative;
}

.gis-gallery-prompt-line input {
  min-height: 4rem;
  border-color: #e4e7ed;
  border-radius: 1rem;
  padding: 0 3rem 0 1.25rem;
  color: #272b33;
  font-size: 1.05rem;
  font-weight: 650;
  box-shadow: none;
}

.gis-gallery-clear-prompt {
  position: absolute;
  top: 50%;
  right: 1rem;
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  transform: translateY(-50%);
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #9aa1ad;
  cursor: pointer;
}

.gis-gallery-control-row {
  display: grid;
  grid-template-columns:
    minmax(7rem, 1fr)
    minmax(7rem, 1fr)
    minmax(7rem, 1fr)
    minmax(7rem, 1fr)
    minmax(7rem, 1fr)
    minmax(6rem, 1fr)
    3.6rem
    3.6rem;
  gap: 0.65rem;
  align-items: end;
}

.gis-gallery-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.35rem;
}

.gis-gallery-field > span:first-child {
  color: #9aa1ad;
  font-size: 0.9rem;
  font-weight: 700;
}

.gis-gallery-select-control {
  position: relative;
  display: block;
}

.gis-gallery-select-control select,
.gis-gallery-field input {
  width: 100%;
  min-height: 2.75rem;
  appearance: none;
  border: 1px solid #e4e7ed;
  border-radius: 0.85rem;
  background: #fff;
  color: #272b33;
  padding: 0 2.25rem 0 1rem;
  font-size: 0.95rem;
  font-weight: 650;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.05);
}

.gis-gallery-select-control svg {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  color: #9aa1ad;
  pointer-events: none;
}

.gis-gallery-disabled-input {
  color: #b4bac4;
}

.gis-gallery-upload-button,
.gis-gallery-submit-button {
  display: inline-flex;
  width: 3.6rem;
  height: 3.6rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 1rem;
  cursor: pointer;
}

.gis-gallery-upload-button {
  position: relative;
  background: #e5e7eb;
  color: #6b7280;
}

.gis-gallery-upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.gis-gallery-submit-button {
  background: #3b82f6;
  color: #fff;
  box-shadow: none;
}

.gis-section,
.gis-composer {
  padding: 1rem;
}

.gis-section-title {
  margin-bottom: 0.85rem;
  color: #0f1f46;
  font-size: 1rem;
  font-weight: 700;
}

.gis-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.gis-section-head .gis-section-title {
  margin-bottom: 0;
}

.gis-job-status {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  border: 1px solid #dfe8f7;
  border-radius: 999rem;
  background: #f8fbff;
  color: #657493;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 650;
}

.gis-job-status.is-pending {
  border-color: #b9cdfb;
  background: #eef5ff;
  color: #075dff;
}

.gis-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(12rem, 0.8fr) minmax(8rem, 0.5fr);
  gap: 1rem;
  align-items: end;
}

.gis-setting-row {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.55rem;
}

.gis-setting-row > span,
.gis-agent-quick > span {
  color: #24365f;
  font-size: 0.84rem;
  font-weight: 650;
}

.gis-options {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.gis-option {
  display: inline-flex;
  min-width: 3.4rem;
  height: 2.35rem;
  align-items: center;
  justify-content: center;
  border: 1px solid #dce5f4;
  border-radius: 0.4rem;
  background: #f9fbff;
  color: #223457;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.gis-option.is-active {
  border-color: #6ea0ff;
  background: #eef5ff;
  color: #075dff;
  font-weight: 700;
}

.gis-count-input {
  width: 100%;
  min-width: 6rem;
}

.gis-extra-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.75fr);
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e9eef7;
}

.gis-upload-box,
.gis-prompt-square-link {
  position: relative;
  display: flex;
  min-height: 5.4rem;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border: 1px dashed #cbd7ec;
  border-radius: 0.5rem;
  background: #fbfdff;
  color: #617194;
  text-align: center;
  cursor: pointer;
}

.gis-upload-box {
  flex-direction: column;
}

.gis-upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.gis-upload-box svg,
.gis-prompt-square-link svg {
  color: #0b63ff;
}

.gis-upload-box small {
  color: #8a9abc;
}

.gis-prompt-square-link {
  border-style: solid;
  color: #0b63ff;
  font-weight: 700;
}

.gis-prompt-box {
  border: 1px solid #dce5f4;
  border-radius: 0.5rem;
  overflow: hidden;
}

.gis-prompt-box textarea {
  min-height: 8rem;
  border: 0;
  box-shadow: none;
  resize: vertical;
}

.gis-prompt-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid #e8eef8;
  padding: 0.55rem 0.75rem;
  color: #7b89a8;
  font-size: 0.8rem;
}

.gis-empty-canvas {
  display: flex;
  min-height: 12rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1px dashed #cfdaf0;
  border-radius: 0.5rem;
  background:
    linear-gradient(90deg, rgba(219, 231, 255, 0.36) 1px, transparent 1px),
    linear-gradient(0deg, rgba(219, 231, 255, 0.36) 1px, transparent 1px),
    #fbfdff;
  background-size: 2rem 2rem;
  color: #7b89a8;
  text-align: center;
}

.gis-empty-canvas svg {
  color: #9fb0d2;
  width: 3rem;
  height: 3rem;
}

.gis-empty-canvas strong {
  color: #24365f;
}

.gis-generated-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.75rem;
}

.gis-generated-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.55rem;
}

.gis-generated-card img,
.gis-prompt-card img,
.gis-prompt-placeholder,
.gpt-image-studio-dialog-image,
.gpt-image-studio-admin-gallery-item img {
  display: block;
  width: 100%;
  border: 1px solid #dfe8f7;
  border-radius: 0.5rem;
  object-fit: cover;
}

.gis-generated-card img,
.gis-prompt-card img,
.gis-prompt-placeholder {
  aspect-ratio: 1 / 1;
}

.gis-generated-actions {
  display: flex;
  gap: 0.5rem;
}

.gis-recent-jobs {
  background: #fbfdff;
}

.gis-recent-job-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.65rem;
}

.gis-recent-job {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid #dfe8f7;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.55rem;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.gis-recent-job.is-active {
  border-color: #6ea0ff;
  background: #eef5ff;
}

.gis-recent-job img,
.gis-recent-job-placeholder {
  width: 3.75rem;
  height: 3.75rem;
  flex: 0 0 auto;
  border-radius: 0.4rem;
  object-fit: cover;
}

.gis-recent-job-placeholder {
  display: grid;
  place-items: center;
  border: 1px dashed #cfdaf0;
  background: #f8fbff;
  color: #8a9abc;
}

.gis-recent-job > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
}

.gis-recent-job strong {
  overflow: hidden;
  color: #24365f;
  font-size: 0.86rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gis-recent-job small {
  color: #7b89a8;
  font-size: 0.78rem;
}

.gis-generate-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.gis-primary-generate {
  min-width: 15rem;
  background: #0b63ff;
  box-shadow: 0 12px 24px rgba(11, 99, 255, 0.22);
}

.gis-link-button {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: #0b63ff;
  color: #fff;
  padding: 0.45rem 0.85rem;
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
}

.gis-link-button.is-outline {
  border-color: #dfe8f7;
  background: #fff;
  color: #0b63ff;
}

.gis-link-button.is-small {
  min-height: 1.75rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.gis-agent {
  display: grid;
  min-height: 48rem;
  grid-template-columns: 14rem minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: stretch;
  padding: 1rem;
}

.gis-agent-sessions {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.75rem;
  border-right: 1px solid #e8eef8;
  padding-right: 1rem;
}

.gis-agent-session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.gis-agent-session-head strong {
  color: #0f1f46;
}

.gis-agent-session-head button {
  border: 1px solid #cbdaf3;
  border-radius: 0.4rem;
  background: #f8fbff;
  color: #0b63ff;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.gis-agent-session-list {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.5rem;
}

.gis-agent-session-item {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid #dfe8f7;
  border-radius: 0.5rem;
  background: #fff;
  color: inherit;
  padding: 0.65rem 2.2rem 0.65rem 0.75rem;
  text-align: left;
  cursor: pointer;
}

.gis-agent-session-item.is-active {
  border-color: #8cb2ff;
  background: #eef5ff;
}

.gis-agent-session-item > span:first-child {
  overflow: hidden;
  color: #1e3158;
  font-size: 0.9rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gis-agent-session-item small {
  overflow: hidden;
  color: #7b89a8;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gis-agent-session-item [role="button"] {
  position: absolute;
  top: 0.55rem;
  right: 0.5rem;
  display: inline-flex;
  width: 1.45rem;
  height: 1.45rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.35rem;
  color: #8a97ad;
}

.gis-agent-session-item [role="button"]:hover {
  background: #fff1f2;
  color: #dc2626;
}

.gis-agent-messages {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  min-width: 0;
  min-height: 33rem;
  flex-direction: column;
  gap: 0.9rem;
}

.gis-chat-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.gis-chat-row.is-user {
  justify-content: flex-end;
}

.gis-chat-row.is-user .gis-chat-avatar {
  order: 2;
}

.gis-chat-avatar,
.gis-avatar {
  display: flex;
  width: 2.8rem;
  height: 2.8rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 999rem;
  background: #eaf2ff;
  color: #0b63ff;
  font-weight: 800;
}

.gis-avatar {
  width: 4.35rem;
  height: 4.35rem;
}

.gis-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gis-chat-bubble,
.gis-agent-guide,
.gis-agent-result {
  max-width: min(42rem, 82%);
  border: 1px solid #dfe8f7;
  border-radius: 0.5rem;
  background: #fbfdff;
  padding: 0.85rem 1rem;
}

.gis-chat-row.is-user .gis-chat-bubble {
  background: #eaf2ff;
  color: #0b3f99;
}

.gis-chat-bubble p {
  margin: 0;
  line-height: 1.65;
}

.gis-chat-bubble time {
  display: block;
  margin-top: 0.35rem;
  color: #7b89a8;
  font-size: 0.75rem;
}

.gis-agent-guide {
  margin-left: 3.55rem;
}

.gis-guide-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid #e8eef8;
}

.gis-guide-items > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
  color: #253b67;
}

.gis-guide-items svg {
  color: #0b63ff;
}

.gis-guide-items small,
.gis-agent-chips button,
.gis-agent-quick {
  color: #657493;
}

.gis-agent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.gis-agent-chips button,
.gis-square-filters button,
.gis-prompt-tags span {
  border: 1px solid #dfe8f7;
  border-radius: 0.4rem;
  background: #f8fbff;
  padding: 0.45rem 0.7rem;
  color: #26406f;
  font-size: 0.82rem;
  cursor: pointer;
}

.gis-agent-result {
  margin-left: 3.55rem;
  padding: 0.55rem;
}

.gis-agent-result img {
  width: 100%;
  max-height: 16rem;
  border-radius: 0.4rem;
  object-fit: cover;
}

.gis-agent-result > div {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.gis-agent-result-pending {
  min-height: 9rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #7b89a8;
  text-align: center;
}

.gis-agent-result-pending svg {
  color: #9fb0d2;
}

.gis-agent-result-pending strong {
  color: #24365f;
}

.gis-agent-input {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  border: 1px solid #0b63ff;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.7rem;
}

.gis-composer.is-compact {
  border: 0;
  padding: 0;
  box-shadow: none;
}

.gis-composer.is-compact .gis-prompt-box {
  border: 0;
}

.gis-composer.is-compact textarea {
  min-height: 4.2rem;
}

.gis-send-button {
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
}

.gis-agent-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  border-top: 1px solid #e8eef8;
  padding-top: 0.65rem;
}

.gis-square {
  padding: 1rem;
}

.gis-square-header {
  display: grid;
  grid-template-columns: auto minmax(12rem, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.gis-square-header h2 {
  margin: 0;
  font-size: 1.35rem;
  color: #0f1f46;
}

.gis-square-header > div {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.gis-square-header svg {
  color: #0b63ff;
}

.gis-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid #dfe8f7;
  border-radius: 0.5rem;
  background: #fbfdff;
  padding: 0 0.75rem;
}

.gis-search input {
  width: 100%;
  min-height: 2.6rem;
  border: 0;
  outline: 0;
  background: transparent;
}

.gis-square-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0;
}

.gis-square-filters button.is-active {
  border-color: #6ea0ff;
  background: #eef5ff;
  color: #075dff;
  font-weight: 700;
}

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

.gis-prompt-card {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 1rem;
  border: 1px solid #dfe8f7;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.75rem;
}

.gis-prompt-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eaf2ff;
  color: #0b63ff;
}

.gis-prompt-card h3 {
  margin: 0;
  color: #112754;
  font-size: 1.05rem;
}

.gis-prompt-card p {
  display: -webkit-box;
  margin: 0.65rem 0;
  overflow: hidden;
  color: #617194;
  font-size: 0.9rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gis-prompt-card-top,
.gis-prompt-tags {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.gis-prompt-card-top {
  justify-content: space-between;
}

.gis-prompt-card-top button {
  border: 0;
  background: transparent;
  color: #617194;
  cursor: pointer;
}

.gis-prompt-tags {
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.gis-prompt-tags span {
  padding: 0.25rem 0.5rem;
}

.gis-usage-rail {
  align-self: start;
  position: sticky;
  top: 4.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.gis-rail-card {
  padding: 1rem;
}

.gis-profile-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.gis-profile-card > div:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.35rem;
}

.gis-profile-card strong {
  color: #0f1f46;
  font-size: 1.1rem;
}

.gis-profile-card span,
.gis-rail-title a,
.gis-rail-title span:last-child,
.gis-vip-row span,
.gis-rail-card p {
  color: #657493;
  font-size: 0.8rem;
}

.gis-rail-title,
.gis-cost-row,
.gis-vip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.gis-rail-title {
  margin-bottom: 0.85rem;
  color: #0f1f46;
  font-weight: 700;
}

.gis-quota-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gis-quota-body strong {
  color: #0b63ff;
  font-size: 2.3rem;
  line-height: 1;
}

.gis-quota-body small {
  display: block;
  margin-top: 0.6rem;
  color: #7b89a8;
}

.gis-ring {
  --value: 0%;
  display: grid;
  width: 5.2rem;
  height: 5.2rem;
  place-items: center;
  border-radius: 999rem;
  background: conic-gradient(#0b63ff var(--value), #e8eefc 0);
}

.gis-ring span {
  display: grid;
  width: 3.7rem;
  height: 3.7rem;
  place-items: center;
  border-radius: inherit;
  background: #fff;
  color: #0b63ff;
  font-weight: 800;
}

.gis-cost-row {
  border-bottom: 1px solid #e9eef7;
  padding: 0.75rem 0;
}

.gis-cost-row:first-child {
  padding-top: 0;
}

.gis-cost-row svg,
.gis-vip-row svg,
.gis-stat-grid svg {
  color: #0b63ff;
}

.gis-cost-row strong {
  color: #0b63ff;
}

.gis-topup {
  width: 100%;
  margin-top: 0.85rem;
  background: #0b63ff;
}

a.gis-topup {
  color: #fff;
}

.gis-vip-row {
  justify-content: flex-start;
}

.gis-vip-row strong {
  color: #0f1f46;
}

.gis-vip-row span {
  margin-left: auto;
}

.gis-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.gis-stat-grid > div {
  min-width: 0;
  border-right: 1px solid #e9eef7;
  padding-right: 0.5rem;
}

.gis-stat-grid span {
  display: block;
  color: #7b89a8;
  font-size: 0.75rem;
}

.gis-stat-grid strong {
  color: #0f1f46;
}

.gpt-image-studio-dialog-image {
  max-height: 70vh;
  object-fit: contain;
}

.gpt-image-studio-admin-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.75rem;
}

.gpt-image-studio-admin-gallery-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.gpt-image-studio-admin-gallery-item img {
  aspect-ratio: 1 / 1;
}

.gpt-image-studio-admin-gallery-item span {
  display: -webkit-box;
  overflow: hidden;
  color: #657493;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gis-admin-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.25rem 0 5rem;
}

.gis-admin-overview,
.gis-admin-sticky-save {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.gis-admin-overview h2 {
  margin: 0;
  font-size: 1.25rem;
}

.gis-admin-overview p,
.gis-admin-feedback,
.gis-admin-muted {
  margin: 0.35rem 0 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.88rem;
  line-height: 1.6;
}

.gis-admin-actions,
.gis-admin-badges,
.gis-admin-card-head,
.gis-mode-checks,
.gis-rule-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.gis-admin-grid,
.gis-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding-top: 1rem;
}

.gis-admin-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.5rem;
}

.gis-admin-field-label {
  display: flex;
  min-height: 2.2rem;
  flex-direction: column;
  gap: 0.2rem;
}

.gis-admin-field-label span {
  color: hsl(var(--foreground));
  font-size: 0.88rem;
  font-weight: 650;
}

.gis-admin-field-label small {
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  line-height: 1.35;
}

.gis-admin-toggle {
  display: flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--card));
  padding: 0 0.75rem;
}

.gis-rule-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding-top: 1rem;
}

.gis-rule-card {
  padding: 1rem;
}

.gis-rule-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.gis-rule-head strong {
  display: block;
  color: #0f1f46;
}

.gis-rule-head span {
  display: block;
  color: #657493;
  font-size: 0.8rem;
}

.gis-mode-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.4rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.84rem;
}

.gis-admin-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.gis-admin-card-content {
  padding-top: 1rem;
}

.gis-admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.gis-admin-list-item {
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--muted) / 0.18);
  padding: 0.8rem;
}

.gis-admin-list-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
}

.gis-admin-list-item p {
  display: -webkit-box;
  margin: 0.5rem 0 0;
  overflow: hidden;
  color: hsl(var(--muted-foreground));
  font-size: 0.86rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gis-admin-list-item small {
  color: hsl(var(--muted-foreground));
}

.gis-admin-sticky-save {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
}

.gis-admin-sticky-save span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #657493;
  font-size: 0.85rem;
}

@media (max-width: 1024px) {
  .gis-shell {
    grid-template-columns: 1fr;
  }

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

  .gis-usage-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .gis-main {
    padding: 0.75rem;
  }

  .gis-main.is-gallery-main {
    padding: 0;
  }

  .gis-gallery-canvas {
    min-height: 22rem;
    padding-bottom: 1rem;
  }

  .gis-gallery-task-grid,
  .gis-gallery-task-card,
  .gis-gallery-detail-layout {
    grid-template-columns: 1fr;
  }

  .gis-gallery-task-card {
    height: auto;
  }

  .gis-gallery-detail-meta {
    order: -1;
  }

  .gis-gallery-composer-panel {
    position: static;
    border-radius: 1rem;
    padding: 0.85rem;
  }

  .gis-gallery-control-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gis-gallery-upload-button,
  .gis-gallery-submit-button {
    width: 100%;
  }

  .gis-top-tabs,
  .gis-generate-row,
  .gis-admin-overview,
  .gis-admin-sticky-save {
    align-items: stretch;
    flex-direction: column;
  }

  .gis-settings-grid,
  .gis-extra-grid,
  .gis-square-header,
  .gis-square-grid,
  .gis-prompt-card,
  .gis-usage-rail,
  .gis-admin-grid,
  .gis-rule-grid,
  .gis-admin-dashboard {
    grid-template-columns: 1fr;
  }

  .gis-mode-tab {
    flex: 1 1 auto;
    justify-content: center;
    padding: 0 0.75rem;
  }

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

  .gis-agent {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .gis-agent-sessions,
  .gis-agent-messages,
  .gis-agent-input {
    grid-column: 1;
    grid-row: auto;
  }

  .gis-agent-sessions {
    border-right: 0;
    border-bottom: 1px solid #e8eef8;
    padding-right: 0;
    padding-bottom: 0.85rem;
  }

  .gis-agent-session-list {
    overflow-x: auto;
    flex-direction: row;
    padding-bottom: 0.1rem;
  }

  .gis-agent-session-item {
    width: 12rem;
    flex: 0 0 12rem;
  }

  .gis-chat-bubble,
  .gis-agent-guide,
  .gis-agent-result {
    max-width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .gis-shell {
    padding-top: 0.35rem;
  }

  .gis-gallery-control-row {
    grid-template-columns: 1fr;
  }

  .gis-gallery-prompt-line input {
    min-height: 3.4rem;
    font-size: 0.95rem;
  }

  .gis-gallery-refs {
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  .gis-top-tabs {
    gap: 0.35rem;
  }

  .gis-mode-tab {
    min-height: 2.7rem;
    font-size: 0.82rem;
  }

  .gis-guide-items,
  .gis-stat-grid {
    grid-template-columns: 1fr;
  }

  .gis-primary-generate {
    width: 100%;
    min-width: 0;
  }
}
