:root {
  color-scheme: light;
  --desktop: #edf1f6;
  --surface: rgba(255, 255, 255, .82);
  --solid: #ffffff;
  --chrome: rgba(246, 248, 251, .86);
  --sidebar: rgba(244, 246, 249, .78);
  --text: #15171c;
  --muted: #68707d;
  --line: rgba(30, 36, 45, .12);
  --line-strong: rgba(30, 36, 45, .18);
  --blue: #2563eb;
  --green: #0f8b63;
  --red: #c73535;
  --amber: #c77a08;
  --shadow: 0 26px 80px rgba(38, 48, 67, .18);
  --radius: 8px;
}

* { box-sizing: border-box; }

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(135deg, #e7ecf5 0%, #fbfcff 46%, #e8f0ee 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .12;
  background:
    linear-gradient(rgba(237, 241, 246, .3), rgba(237, 241, 246, .9)),
    url("https://cos-agnes-website.agnes-ai.com/image/banner-models-bg-renew.jpg") center / cover no-repeat;
  filter: saturate(.7);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(26, 33, 46, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 33, 46, .035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: var(--blue);
}

.icon {
  width: 17px;
  height: 17px;
  display: inline-block;
  flex: 0 0 auto;
  color: currentColor;
}

.desktop,
.auth-shell {
  min-height: 100vh;
  padding: 26px;
  display: grid;
  place-items: center;
}

.app-window,
.login-window {
  width: min(1460px, 100%);
  min-height: calc(100vh - 52px);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 12px;
  background: rgba(255, 255, 255, .62);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.25);
  overflow: hidden;
}

.window-bar {
  height: 46px;
  display: grid;
  grid-template-columns: 86px 1fr 120px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(30, 36, 45, .1);
  background: var(--chrome);
}

.traffic {
  display: flex;
  align-items: center;
  gap: 8px;
}

.traffic span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}

.traffic .red { background: #ff5f57; }
.traffic .yellow { background: #febc2e; }
.traffic .green { background: #28c840; }

.window-title {
  justify-self: center;
  color: rgba(21, 23, 28, .64);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.window-right {
  justify-self: end;
}

.bar-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: rgba(21, 23, 28, .68);
  background: rgba(255, 255, 255, .58);
  font-size: 12px;
}

.layout {
  min-height: calc(100vh - 98px);
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 18px;
  background: var(--sidebar);
  border-right: 1px solid rgba(30, 36, 45, .1);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #20242c, #111318);
  color: #fff;
  font-weight: 760;
  box-shadow: 0 8px 20px rgba(18, 24, 35, .18);
}

.brand-title {
  font-weight: 740;
  color: var(--text);
}

.brand-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border-radius: var(--radius);
  background: transparent;
  color: #56606f;
  cursor: pointer;
  text-align: left;
}

.nav button:hover {
  background: rgba(255, 255, 255, .5);
  color: var(--text);
}

.nav button.active {
  background: rgba(255, 255, 255, .92);
  color: var(--text);
  border: 1px solid rgba(30, 36, 45, .08);
  box-shadow: 0 8px 24px rgba(38, 48, 67, .08);
}

.side-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .58);
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #dfe5ee;
  color: #343a45;
  font-weight: 720;
}

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

.user-name,
.user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 680;
}

.user-email,
.task-meta,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 20px;
}

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

.eyebrow {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 720;
}

.topbar h1 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1.15;
  font-weight: 760;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(30, 36, 45, .1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .72);
}

.metric .k,
.metric .sub {
  color: var(--muted);
  font-size: 12px;
}

.metric .v {
  margin: 4px 0 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 740;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid rgba(30, 36, 45, .1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 18px 45px rgba(38, 48, 67, .08);
  overflow: hidden;
}

.panel-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid rgba(30, 36, 45, .1);
  background: rgba(250, 251, 253, .7);
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 740;
}

.panel-head .sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.panel-body {
  padding: 15px;
}

.form {
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: #3e4653;
  font-size: 12px;
  font-weight: 680;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid rgba(30, 36, 45, .13);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 10px 11px;
  transition: border .15s ease, box-shadow .15s ease;
}

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

.field textarea.short {
  min-height: 88px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(37, 99, 235, .55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.switch-line input {
  width: 17px;
  height: 17px;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s ease, background .15s ease, border .15s ease, opacity .15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: .55;
  cursor: wait;
  transform: none;
}

.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #20242c, #111318);
  border-color: rgba(0, 0, 0, .12);
  box-shadow: 0 9px 24px rgba(17, 19, 24, .18);
}

.btn.secondary {
  color: #20242c;
  background: rgba(255, 255, 255, .82);
  border-color: var(--line-strong);
}

.btn.ghost {
  color: #3e4653;
  background: rgba(255, 255, 255, .58);
  border-color: var(--line);
}

.result-panel {
  min-height: 560px;
}

.result-stage {
  display: grid;
  gap: 14px;
  padding: 15px;
}

.empty {
  min-height: 440px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty.compact {
  min-height: 168px;
  border: 1px dashed rgba(30, 36, 45, .16);
  border-radius: var(--radius);
  background: rgba(250, 251, 253, .68);
}

.empty strong {
  color: var(--text);
  font-size: 17px;
}

.empty-visual {
  width: 170px;
  height: 108px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(240, 244, 250, .86)),
    url("https://cos-agnes-website.agnes-ai.com/image/banner-models-bg-renew.jpg") center / cover no-repeat;
  border: 1px solid rgba(30, 36, 45, .1);
  box-shadow: 0 16px 36px rgba(38, 48, 67, .12);
}

.live-events {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(30, 36, 45, .09);
  border-radius: var(--radius);
  background: rgba(250, 251, 253, .78);
}

.event-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  color: #4b5565;
  font-size: 12px;
}

.event-row time {
  color: #8a93a1;
}

.event-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 139, 99, .1);
}

.output-text {
  min-height: 220px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.78;
  padding: 16px;
  border: 1px solid rgba(30, 36, 45, .1);
  border-radius: var(--radius);
  background: #fff;
  color: #1b2029;
  font-size: 15px;
}

.output-text.live::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 3px;
  vertical-align: -2px;
  border-radius: 2px;
  background: var(--blue);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.usage {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(30, 36, 45, .12);
  border-radius: 999px;
  color: #56606f;
  background: rgba(255, 255, 255, .72);
  font-size: 12px;
}

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

.image-card,
.video-card,
.task-row,
.task-mini,
.history button {
  border: 1px solid rgba(30, 36, 45, .1);
  border-radius: var(--radius);
  background: #fff;
}

.image-card {
  overflow: hidden;
}

.image-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  background: #e9edf4;
}

.image-card a,
.video-card a,
.task-mini a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  color: var(--blue);
  text-decoration: none;
  font-size: 13px;
}

.video-card {
  overflow: hidden;
}

.video-card video {
  width: 100%;
  max-height: 520px;
  display: block;
  background: #0f1115;
}

.task-row {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  font-size: 13px;
}

.task-top strong,
.task-mini strong {
  overflow-wrap: anywhere;
}

.bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.bar span {
  height: 100%;
  display: block;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.tasks-list,
.history {
  display: grid;
  gap: 9px;
  padding: 0 15px 15px;
}

.list-title {
  color: #56606f;
  font-size: 12px;
  font-weight: 720;
}

.task-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  font-size: 12px;
}

.task-mini strong,
.task-mini span {
  display: block;
}

.task-mini span {
  margin-top: 2px;
  color: var(--muted);
}

.history button {
  width: 100%;
  text-align: left;
  padding: 10px 11px;
  color: var(--text);
  cursor: pointer;
}

.history strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.history .meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.error-panel {
  margin: 15px;
  padding: 16px;
  border: 1px solid rgba(199, 53, 53, .22);
  border-radius: var(--radius);
  background: #fff6f5;
  color: #4f1818;
}

.error-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #a42b2b;
  background: rgba(199, 53, 53, .1);
  font-size: 12px;
  font-weight: 760;
}

.error-panel h3 {
  margin: 10px 0 6px;
  font-size: 17px;
}

.error-panel p {
  margin: 0 0 10px;
  line-height: 1.6;
  color: rgba(79, 24, 24, .72);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(380px, calc(100vw - 36px));
  padding: 11px 13px;
  border-radius: var(--radius);
  background: #15171c;
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.err { background: #9d2929; }
.toast.ok { background: #0d7353; }

.login-window {
  width: min(1060px, calc(100vw - 32px));
  min-height: auto;
}

.login-body {
  display: grid;
  grid-template-columns: minmax(300px, .86fr) minmax(360px, 1.14fr);
  gap: 22px;
  padding: 24px;
}

.login-copy {
  align-self: center;
  padding: 12px 8px 12px 4px;
}

.login-copy h1 {
  max-width: 480px;
  margin: 34px 0 12px;
  color: var(--text);
  font-size: 42px;
  line-height: 1.06;
  font-weight: 780;
}

.login-copy p {
  max-width: 480px;
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.75;
}

.login-preview {
  min-height: 430px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
}

.preview-screen {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(30, 36, 45, .1);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(239, 244, 251, .88)),
    url("https://cos-agnes-website.agnes-ai.com/image/banner-models-bg-renew.jpg") center / cover no-repeat;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

.preview-toolbar {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border-bottom: 1px solid rgba(30, 36, 45, .08);
  background: rgba(255, 255, 255, .62);
  color: #667085;
  font-size: 12px;
  font-weight: 680;
}

.preview-card-row {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.preview-model {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .58);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(16px);
}

.preview-model span {
  color: var(--muted);
  font-size: 12px;
}

.preview-model strong {
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.preview-status {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(30, 36, 45, .1);
  border-radius: 999px;
  background: rgba(255, 255, 255, .62);
  color: #56606f;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.status-dot.live {
  box-shadow: 0 0 0 5px rgba(15, 139, 99, .12);
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 820px) {
  .desktop,
  .auth-shell {
    padding: 0;
    place-items: stretch;
  }

  .app-window,
  .login-window {
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .window-bar {
    grid-template-columns: 72px 1fr 84px;
    padding: 0 12px;
  }

  .layout,
  .login-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(30, 36, 45, .1);
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav button {
    justify-content: center;
    padding: 0 8px;
  }

  .side-foot {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .main {
    padding: 14px;
  }

  .login-copy h1 {
    margin-top: 24px;
    font-size: 34px;
  }

  .login-preview {
    min-height: 340px;
  }
}

@media (max-width: 560px) {
  .window-title {
    font-size: 12px;
  }

  .window-right {
    display: none;
  }

  .window-bar {
    grid-template-columns: 74px 1fr;
  }

  .sidebar {
    padding: 12px;
  }

  .nav {
    gap: 6px;
  }

  .nav button {
    height: 38px;
    gap: 6px;
    font-size: 13px;
  }

  .status-strip {
    display: none;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 12px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .workspace {
    gap: 12px;
  }

  .grid-2,
  .preview-card-row {
    grid-template-columns: 1fr;
  }

  .actions {
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .side-foot {
    grid-template-columns: 1fr;
  }

  .login-body {
    padding: 16px;
  }

  .login-preview {
    min-height: 460px;
  }
}
