:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --panel: #ffffff;
  --ink: #192127;
  --muted: #59646b;
  --line: #dfe4e7;
  --green: #167a65;
  --green-soft: #e7f3ef;
  --coral: #d76b4b;
  --yellow: #f0c75e;
  --danger: #b83b3b;
  --radius: 7px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}
button,
textarea,
select,
input {
  font: inherit;
  letter-spacing: 0;
}
button {
  cursor: pointer;
}
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #20282d;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  padding: 0 8px 24px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--yellow);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.brand-mark img {
  width: 19px;
  height: 19px;
  filter: brightness(0.2);
}
.brand strong,
.brand small {
  display: block;
}
.brand strong {
  font-size: 15px;
}
.brand small {
  margin-top: 1px;
  color: #b8c0c5;
  font-size: 12px;
}
.primary-nav {
  display: grid;
  gap: 4px;
}
.nav-item {
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #bfc7cc;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  text-align: left;
}
.nav-item img,
.icon-button img,
.primary-button img,
.upload-button img {
  width: 18px;
  height: 18px;
}
.nav-item img {
  filter: invert(78%);
}
.nav-item:hover,
.nav-item.is-active {
  background: #313b41;
  color: white;
}
.nav-item.is-active img {
  filter: invert(100%);
}
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid #394349;
  padding: 16px 6px 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 9px;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.user-copy {
  min-width: 0;
}
.user-copy strong,
.user-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-copy strong {
  font-size: 13px;
}
.user-copy span {
  font-size: 11px;
  color: #aeb7bc;
  margin-top: 2px;
}
.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  display: grid;
  place-items: center;
}
.sidebar .icon-button {
  border-color: #465158;
  background: transparent;
}
.sidebar .icon-button img {
  filter: invert(80%);
}
.workspace {
  min-width: 0;
}
.topbar {
  height: 86px;
  padding: 18px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(244, 246, 247, 0.96);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}
.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.connection {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.connection i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.view {
  display: none;
  padding: 30px clamp(20px, 4vw, 48px) 60px;
}
.view.is-active {
  display: block;
}
.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: clamp(26px, 4vw, 54px);
  max-width: 1240px;
}
.composer {
  min-width: 0;
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px;
  background: #eaedef;
  gap: 2px;
}
.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}
.segmented button.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px #1c252b14;
}
.segmented button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}
.prompt-field {
  position: relative;
  display: block;
  margin-top: 22px;
}
.prompt-field > span,
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 650;
}
.prompt-field textarea {
  width: 100%;
  resize: vertical;
  min-height: 168px;
  padding: 16px 16px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  line-height: 1.65;
  outline: none;
}
.prompt-field textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px #167a651a;
}
.prompt-field small {
  position: absolute;
  right: 11px;
  bottom: 9px;
  color: var(--muted);
}
.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.control-field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 0 34px 0 11px;
  color: var(--ink);
}
.ratio-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.ratio-option {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
}
.ratio-option.is-active {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}
.submit-row {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.estimate {
  color: var(--muted);
  font-size: 13px;
}
.primary-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--green);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-decoration: none;
  font-weight: 650;
}
.primary-button img {
  filter: invert(100%);
}
.primary-button:hover {
  background: #116653;
}
.primary-button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.upload-zone {
  margin-top: 18px;
  border: 1px dashed #b9c3c8;
  border-radius: var(--radius);
  background: #f9fafb;
  padding: 14px;
}
.upload-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.upload-button {
  border: 0;
  background: transparent;
  color: var(--green);
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px;
}
.upload-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.upload-thumb {
  width: 66px;
  height: 66px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid var(--line);
}
.recent-panel {
  border-left: 1px solid var(--line);
  padding-left: 26px;
  min-width: 0;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-heading h2 {
  font-size: 15px;
  margin: 0;
}
.text-button {
  border: 0;
  padding: 6px;
  color: var(--green);
  background: transparent;
}
.recent-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.recent-item {
  border-bottom: 1px solid var(--line);
  padding: 0 0 13px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 11px;
}
.recent-preview {
  width: 50px;
  height: 50px;
  border-radius: 5px;
  background: #e5e9eb;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.recent-preview img {
  width: 20px;
  opacity: 0.5;
}
.recent-preview .result-image {
  width: 100%;
  height: 100%;
  opacity: 1;
  object-fit: cover;
}
.recent-copy {
  min-width: 0;
}
.recent-copy strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-copy span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
}
.status.success::before {
  background: var(--green);
}
.status.failed::before {
  background: var(--danger);
}
.library-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1240px;
}
.library-toolbar > span {
  color: var(--muted);
  font-size: 13px;
}
.asset-grid {
  margin-top: 22px;
  max-width: 1240px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.asset-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.asset-media {
  aspect-ratio: 4/3;
  background: #e7ebed;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.asset-media > img,
.asset-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.asset-media > img.placeholder {
  width: 30px;
  height: 30px;
  opacity: 0.42;
}
.asset-body {
  padding: 13px;
}
.asset-body h3 {
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asset-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}
.asset-actions {
  margin-top: 12px;
  display: flex;
  gap: 7px;
}
.secondary-button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.secondary-button img {
  width: 15px;
  height: 15px;
}
.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 32px 0;
}
.is-hidden {
  display: none !important;
}
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #20282d;
  color: white;
  display: grid;
  place-items: center;
}
.login-brand {
  display: grid;
  justify-items: center;
  gap: 18px;
}
.login-brand .brand-mark {
  width: 52px;
  height: 52px;
}
.login-brand h1 {
  font-size: 24px;
  margin: 0 0 8px;
}
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: grid;
  gap: 8px;
}
.toast {
  max-width: 360px;
  background: #20282d;
  color: white;
  border-radius: 6px;
  padding: 12px 15px;
  box-shadow: 0 10px 30px #0003;
  font-size: 13px;
}
.toast.error {
  background: #7f2929;
}
@media (max-width: 980px) {
  .work-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .recent-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 24px 0 0;
  }
  .asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .shell {
    display: block;
    padding-bottom: 68px;
  }
  .sidebar {
    position: fixed;
    z-index: 20;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    height: 64px;
    padding: 7px max(8px, env(safe-area-inset-right))
      calc(7px + env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    display: block;
  }
  .brand,
  .sidebar-footer {
    display: none;
  }
  .primary-nav {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .nav-item {
    height: 50px;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    padding: 0;
    font-size: 10px;
  }
  .nav-item img {
    width: 18px;
    height: 18px;
  }
  .topbar {
    height: 72px;
    padding: 14px 16px;
  }
  .topbar h1 {
    font-size: 19px;
  }
  .topbar p,
  .connection {
    display: none;
  }
  .view {
    padding: 20px 16px 42px;
  }
  .control-grid {
    grid-template-columns: 1fr;
  }
  .submit-row {
    align-items: stretch;
    flex-direction: column;
  }
  .primary-button {
    width: 100%;
  }
  .asset-grid {
    grid-template-columns: 1fr;
  }
  .segmented {
    max-width: 100%;
    overflow-x: auto;
  }
  .segmented button {
    padding: 0 13px;
  }
  .toast-region {
    left: 12px;
    right: 12px;
    bottom: 78px;
  }
  .toast {
    max-width: none;
  }
}
