:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --muted: #8c8c8c;
  --text: #232323;
  --line: #e7e7e7;
  --soft: #f1f1f1;
  --danger: #ff7875;
  --danger-soft: #ffd6d6;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(760px, 1fr);
  min-width: 1020px;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
  padding: 24px 12px;
  background: #f7f7f7;
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.collapse-btn,
.dialog-close {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 0;
  color: #9b9b9b;
  background: transparent;
}

.collapse-btn svg,
.dialog-close svg {
  width: 18px;
  height: 18px;
}

.primary-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: #171717;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #ededed;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 2;
}

.conversation-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.conversation-list h2 {
  margin: 0 0 8px;
  padding: 0 16px;
  color: #9c9c9c;
  font-size: 13px;
  font-weight: 500;
}

.conversation-list button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #111;
  text-align: left;
}

.conversation-list button:hover {
  background: #ededed;
}

.side-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.login-outline {
  height: 44px;
  border: 1px solid #dedede;
  border-radius: 999px;
  background: #fff;
  color: #111;
}

.side-footer p {
  margin: 0;
  color: #9e9e9e;
  font-size: 12px;
  text-align: center;
}

.workspace {
  position: relative;
  margin: 12px 12px 12px 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.01);
}

.login-pill {
  position: absolute;
  top: 12px;
  right: 24px;
  z-index: 4;
  height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #202124;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.hero-panel {
  width: min(800px, calc(100% - 128px));
  margin: 0 auto;
  padding-top: 240px;
}

.hero-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 4px;
}

.hero-title img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  transform: translateY(10px);
}

.hero-title h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 760;
  color: #333;
}

.composer {
  min-height: 146px;
  border: 1px solid var(--danger-soft);
  border-radius: 14px;
  background: #fff;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: #ff9b98;
  box-shadow: 0 12px 38px rgba(255, 120, 117, 0.12);
}

.composer-top {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  padding: 16px 16px 8px;
}

.add-file {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px dashed #ddd;
  border-radius: 8px;
  background: #fafafa;
  color: #b5b5b5;
}

.add-file svg {
  width: 21px;
  height: 21px;
}

textarea {
  width: 100%;
  min-height: 68px;
  max-height: 128px;
  padding: 3px 0;
  border: 0;
  outline: 0;
  resize: vertical;
  color: #333;
  background: transparent;
  line-height: 1.6;
}

textarea::placeholder {
  color: #b7b7b7;
}

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 2px 80px;
}

.attachment-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #555;
  background: #fafafa;
  font-size: 12px;
}

.attachment-pill svg {
  width: 14px;
  height: 14px;
}

.attachment-pill button {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: #999;
  background: transparent;
}

.tab-badge {
  align-self: start;
  margin-top: 3px;
  padding: 3px 5px;
  border-radius: 4px;
  color: #b9b9b9;
  background: #f2f2f2;
  font-size: 12px;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px 16px;
}

.left-actions,
.right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.soft-btn,
.model-btn,
.send-btn,
.pager button {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
}

.soft-btn {
  min-width: 32px;
  padding: 0 9px;
  color: #303030;
  background: #f4f4f4;
}

.soft-btn.with-label {
  gap: 5px;
  padding: 0 12px;
}

.soft-btn svg,
.model-btn svg {
  width: 16px;
  height: 16px;
}

.model-btn {
  gap: 5px;
  padding: 0 8px;
  color: #6d6d6d;
  background: transparent;
}

.model-btn:hover {
  background: #f4f4f4;
}

.send-btn {
  width: 32px;
  color: #fff;
  background: #111;
}

.send-btn:disabled {
  color: #fff;
  background: #bdbdbd;
  cursor: not-allowed;
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.chat-result {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfc;
}

.chat-result strong {
  display: block;
  margin-bottom: 8px;
}

.chat-result p {
  margin: 0;
  color: #666;
  line-height: 1.7;
}

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

.result-grid div {
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.result-grid span {
  display: block;
  margin-bottom: 5px;
  color: #8d8d8d;
  font-size: 12px;
}

.plan-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: #4f4f4f;
  line-height: 1.8;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.result-actions button,
.tool-head button,
.card-toolbar button,
.file-row button,
.list-row button,
.primary-mini,
.channel-form-actions button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: #222;
  background: #fff;
}

.result-actions svg,
.tool-head svg,
.card-toolbar svg {
  width: 16px;
  height: 16px;
}

.templates {
  margin-top: 32px;
}

.template-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.tab {
  border: 0;
  padding: 0;
  color: #7d7d7d;
  background: transparent;
  font-weight: 500;
  white-space: nowrap;
}

.tab.active {
  color: #101010;
  font-weight: 800;
}

.pager {
  display: flex;
  gap: 8px;
}

.pager button {
  width: 32px;
  border: 1px solid #eeeeee;
  color: #8c8c8c;
  background: #fff;
}

.pager button:disabled {
  color: #d5d5d5;
}

.pager svg {
  width: 17px;
  height: 17px;
}

.template-scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 118px;
  gap: 34px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 8px 0 24px;
  scrollbar-width: none;
}

.template-scroller::-webkit-scrollbar {
  display: none;
}

.media-card {
  position: relative;
  height: 158px;
  border: 0;
  border-radius: 4px;
  padding: 0;
  background: transparent;
  text-align: left;
  transition:
    transform 160ms ease,
    filter 160ms ease;
}

.media-card:hover {
  transform: translateY(-3px);
  filter: saturate(1.06);
}

.media-stack {
  position: relative;
  height: 100%;
}

.media-stack::before,
.media-stack::after {
  content: "";
  position: absolute;
  top: 8px;
  right: -12px;
  width: 96%;
  height: 92%;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
  transform: rotate(4deg);
}

.media-stack::after {
  right: -20px;
  top: 14px;
  opacity: 0.4;
}

.media-card img {
  position: relative;
  z-index: 2;
  width: 118px;
  height: 158px;
  display: block;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.media-card .shade {
  position: absolute;
  inset: auto 0 0;
  z-index: 3;
  height: 52px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.66));
}

.media-title {
  position: absolute;
  left: 8px;
  right: 20px;
  bottom: 9px;
  z-index: 4;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fill-icon {
  position: absolute;
  right: 8px;
  bottom: 9px;
  z-index: 4;
  color: #fff;
}

.fill-icon svg {
  width: 13px;
  height: 13px;
}

.login-dialog {
  width: min(410px, calc(100vw - 32px));
  border: 0;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
}

.login-dialog::backdrop {
  background: rgba(0, 0, 0, 0.2);
}

.login-dialog form {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 28px;
}

.login-dialog h2 {
  margin: 0;
  font-size: 22px;
}

.login-dialog p {
  margin: -6px 0 4px;
  color: #777;
  line-height: 1.6;
}

.login-dialog label {
  display: grid;
  gap: 7px;
  color: #565656;
  font-size: 13px;
}

.login-dialog input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  outline: 0;
}

.login-dialog input:focus {
  border-color: #ff9b98;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.dialog-submit {
  height: 42px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #202124;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  max-width: 360px;
  transform: translateX(-50%) translateY(24px);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(26, 26, 26, 0.9);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tool-panel {
  width: min(920px, calc(100% - 128px));
  margin: 0 auto;
  padding: 132px 0 64px;
}

.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 10px;
}

.tool-head p {
  margin: 0 0 4px;
  color: #a0a0a0;
  font-size: 13px;
}

.tool-head h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
}

.tool-subtitle {
  max-width: 640px;
  margin: 0 0 22px;
  color: #6f6f6f;
  line-height: 1.7;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(360px, 1.15fr);
  gap: 18px;
}

.work-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.work-card h3,
.card-toolbar h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.form-card,
.brand-form {
  display: grid;
  gap: 14px;
}

.form-card label,
.brand-form label {
  display: grid;
  gap: 8px;
  color: #5f5f5f;
  font-size: 13px;
}

.form-card input,
.form-card select,
.brand-form input,
.channel-form input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 11px;
  color: #222;
  background: #fff;
  outline: 0;
}

.brand-form input[type="color"] {
  padding: 4px;
}

.primary-action {
  height: 42px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #202124;
  font-weight: 700;
}

.list-stack {
  display: grid;
  gap: 10px;
}

.list-row,
.file-row {
  display: grid;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px;
  border: 1px solid #efefef;
  border-radius: 10px;
  background: #fcfcfc;
}

.list-row {
  grid-template-columns: 1fr auto;
}

.list-row strong,
.file-row strong,
.channel-card strong,
.skill-tile strong {
  display: block;
  color: #222;
}

.list-row span,
.channel-card span,
.skill-tile span {
  display: block;
  margin-top: 4px;
  color: #777;
  font-size: 13px;
  line-height: 1.45;
}

.card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.file-table {
  display: grid;
  gap: 8px;
}

.file-row {
  grid-template-columns: 22px minmax(220px, 1fr) 72px 72px 72px auto;
}

.file-row svg {
  width: 18px;
  height: 18px;
  color: #777;
}

.file-row span {
  color: #777;
  font-size: 13px;
}

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

.skill-tile {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  text-align: left;
  box-shadow: var(--shadow);
}

.skill-tile.on {
  border-color: var(--danger-soft);
  background: #fffafa;
}

.skill-tile svg {
  width: 22px;
  height: 22px;
  margin-bottom: 14px;
  color: var(--danger);
}

.tutorial-row {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 16px;
}

.tutorial-row a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4d4d4d;
  font-size: 13px;
  text-decoration: none;
}

.tutorial-row svg {
  width: 15px;
  height: 15px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.channel-card {
  min-height: 150px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.channel-card.on {
  border-color: var(--danger-soft);
  background: #fffafa;
}

.channel-left {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
}

.channel-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #1f1f1f;
  background: #f3f3f3;
}

.channel-icon svg {
  width: 18px;
  height: 18px;
}

.channel-card p {
  margin: 6px 0 0;
  color: #666;
  font-size: 13px;
  line-height: 1.55;
}

.primary-mini {
  justify-self: start;
  min-width: 74px;
}

.channel-form,
.channel-guide {
  margin-top: 14px;
}

.channel-form {
  display: grid;
  gap: 14px;
}

.channel-form[hidden],
.channel-guide[hidden] {
  display: none;
}

.channel-form label {
  display: grid;
  gap: 8px;
  color: #5f5f5f;
  font-size: 13px;
}

.channel-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.switch-line {
  min-height: 34px;
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  margin-right: auto;
}

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

@media (max-width: 1100px) {
  .hero-panel {
    width: 800px;
    margin-left: 24px;
    padding-top: 178px;
  }

  .tool-panel {
    width: 820px;
    margin-left: 24px;
  }
}

@media (max-height: 780px) {
  .hero-panel {
    padding-top: 190px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  .sidebar {
    min-height: auto;
    padding: 14px;
  }

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

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

  .nav-item span {
    display: none;
  }

  .conversation-list,
  .side-footer {
    display: none;
  }

  .workspace {
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
    overflow-x: hidden;
  }

  .login-pill {
    right: 14px;
  }

  .hero-panel,
  .tool-panel {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    margin: 0 auto;
    padding-top: 96px;
  }

  .hero-title {
    align-items: flex-start;
  }

  .hero-title img {
    width: 56px;
    height: 56px;
  }

  .hero-title h1 {
    font-size: 25px;
  }

  .composer-top {
    grid-template-columns: 44px 1fr;
  }

  .tab-badge {
    display: none;
  }

  .composer-actions,
  .template-head,
  .tool-head,
  .card-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .left-actions,
  .right-actions {
    flex-wrap: wrap;
  }

  .attachment-strip {
    padding-left: 16px;
  }

  .templates,
  .template-scroller {
    max-width: 100%;
    min-width: 0;
  }

  .template-scroller {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .result-grid,
  .work-grid,
  .tile-grid,
  .channel-grid {
    grid-template-columns: 1fr;
  }

  .file-row {
    grid-template-columns: 22px 1fr;
  }

  .file-row span,
  .file-row button {
    grid-column: 2;
    justify-self: start;
  }
}
