:root {
  --ink: #17211b;
  --muted: #68736d;
  --line: #dce5df;
  --paper: #fbfcf9;
  --panel: #ffffff;
  --mint: #1d8f73;
  --mint-dark: #116b55;
  --gold: #c8882d;
  --coral: #d65f4f;
  --blue: #3d74a8;
  --shadow: 0 18px 45px rgba(34, 50, 42, 0.12);
}

.auth-gate { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; background:#f4f7fb; }
.auth-gate[hidden] { display:none; }
.auth-box { width:min(380px, calc(100vw - 32px)); padding:32px; border:1px solid var(--line); border-radius:10px; background:#fff; box-shadow:var(--shadow); text-align:center; }
.auth-box .brand-mark { margin:0 auto 16px; }
.auth-box h1 { margin:0 0 8px; font-size:24px; }
.auth-box p { margin:0 0 22px; color:var(--muted); }
.auth-box input { display:block; margin:10px 0; }
.auth-box button { width:100%; margin-top:10px; }
.auth-box small { display:block; margin-top:12px; color:#c33; min-height:18px; }
.admin-grid { display:grid; grid-template-columns:minmax(0, 1.5fr) minmax(280px, .8fr); gap:18px; }
.admin-user-list { display:grid; gap:10px; }
.admin-user-row { display:grid; grid-template-columns:1fr auto minmax(150px, .6fr); align-items:center; gap:16px; padding:14px 0; border-bottom:1px solid var(--line); }
.admin-user-row:last-child { border-bottom:0; }
.admin-user-row div { display:grid; gap:4px; }
.admin-user-row div span, .admin-user-row label { color:var(--muted); font-size:12px; }
.admin-user-row label { display:flex; gap:6px; align-items:center; }
.admin-user-row input { width:76px; }
.credit-rules { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.credit-rules div { display:grid; gap:5px; padding:15px; background:var(--soft); border-radius:8px; }
.credit-rules span { color:var(--muted); font-size:13px; }
.admin-portal .nav-item { display:none; }
.admin-portal .nav-item[data-view="admin"] { display:flex; }
.admin-portal .view { display:none !important; }
.admin-portal .view#admin { display:block !important; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #edf2ee;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 24px 16px;
  background: #14231d;
  color: #f6faf7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e7b85b;
  color: #14231d;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #adc0b6;
  font-size: 12px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #dce8e1;
  text-align: left;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #e7b85b;
  font-size: 18px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  color: #b8c9bf;
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #46ce91;
}

.workspace {
  padding: 28px;
  overflow: hidden;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--mint-dark);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
}

.top-actions,
.panel-head,
.toolbar,
.segmented,
.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast {
  margin: -10px 0 18px;
  border: 1px solid #b6d7cb;
  border-radius: 8px;
  padding: 12px 14px;
  background: #e7f4ef;
  color: var(--mint-dark);
  font-size: 14px;
}

.toast.error {
  border-color: #efc5bc;
  background: #fff1ef;
  color: #a33b2f;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.segmented button,
.tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
}

.primary-btn {
  border-color: var(--mint);
  background: var(--mint);
  color: #fff;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--mint-dark);
}

.ghost-btn:hover,
.icon-btn:hover,
.segmented button.active,
.tab.active {
  border-color: #b6d7cb;
  background: #e7f4ef;
  color: var(--mint-dark);
}

.icon-btn {
  width: 40px;
  padding: 0;
  font-size: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 3px;
  font-size: 32px;
}

.dashboard-layout,
.studio-layout,
.analytics-grid,
.settings-grid,
.service-layout,
.automation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.automation-steps { display:grid; gap:10px; margin:18px 0; }
.automation-step { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 14px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.automation-step span { display:flex; align-items:center; gap:8px; color:var(--ink); }
.automation-step input[type="time"] { width:130px; }
.switch-line { display:flex; align-items:center; gap:8px; color:var(--ink); }
.automation-status { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.automation-status div { padding:16px; background:var(--soft); border-radius:8px; }
.automation-status span, .automation-status b { display:block; }
.automation-status span { color:var(--muted); font-size:13px; margin-bottom:7px; }
.automation-note { margin-top:18px; line-height:1.6; }

.image-workspace {
  grid-template-columns: 1fr;
  align-items: start;
  max-width: 1220px;
  margin: 0 auto;
}

.image-workspace > .panel:first-child {
  max-width: none;
  width: 100%;
  justify-self: stretch;
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 18px 0 0;
}

.image-workspace > .panel:first-child .panel-head {
  display: none;
}

.image-workspace > .panel:last-child {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  max-width: none;
  width: 100%;
  justify-self: stretch;
  align-self: start;
}

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

.ops-card {
  display: grid;
  gap: 6px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: left;
}

.ops-card b {
  font-size: 17px;
}

.ops-card span {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  padding: 18px;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.collector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 118px;
  padding: 12px;
  resize: vertical;
  font: inherit;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(29, 143, 115, 0.12);
}

.form-submit {
  align-self: end;
}

.id-collector {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.id-collector-side {
  display: grid;
  align-content: start;
  gap: 12px;
}

.toolbar {
  margin-bottom: 16px;
}

.toolbar input {
  max-width: 360px;
}

.toolbar select {
  max-width: 180px;
}

.toolbar {
  flex-wrap: wrap;
}

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

.product-card {
  overflow: hidden;
}

.product-media {
  position: relative;
  aspect-ratio: 1.25 / 1;
  background: #eef3f0;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge {
  position: absolute;
  left: 10px;
  top: 10px;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(20, 35, 29, 0.86);
  color: #fff;
  font-size: 12px;
}

.product-body {
  padding: 14px;
}

.product-title {
  min-height: 44px;
  margin: 0 0 12px;
  font-weight: 800;
  line-height: 1.35;
}

.product-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.product-meta span {
  padding: 8px;
  border-radius: 8px;
  background: #f2f6f3;
  color: var(--muted);
  font-size: 12px;
}

.product-meta b {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-actions button {
  flex: 1;
}

.task-list,
.priority-list,
.publish-list,
.bar-list,
.insights,
.conversation-list,
.order-list,
.competitor-list {
  display: grid;
  gap: 12px;
}

.task,
.priority,
.publish-item,
.insight,
.conversation,
.order-item,
.competitor-item {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
}

.conversation {
  text-align: left;
}

.conversation.hot {
  border-color: #efc5bc;
  background: #fff8f5;
}

.conversation span,
.conversation small,
.order-item span,
.competitor-item span {
  color: var(--muted);
}

.competitor-analysis-list {
  display: grid;
  gap: 14px;
}

.analysis-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcf9;
}

.analysis-head {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.analysis-head img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef3f0;
}

.analysis-head div {
  display: grid;
  gap: 6px;
}

.analysis-head span,
.trend-box span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.trend-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.sparkline {
  display: flex;
  align-items: end;
  gap: 6px;
  min-height: 72px;
  padding: 8px;
  border-radius: 8px;
  background: #f2f6f3;
}

.sparkline i {
  display: block;
  flex: 1;
  min-width: 8px;
  border-radius: 6px 6px 2px 2px;
  background: var(--mint);
}

.sparkline i.price {
  background: var(--gold);
}

.sparkline i.sales {
  background: var(--blue);
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-row span {
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef3f0;
  color: var(--ink);
  font-size: 12px;
}

.reply-panel {
  display: grid;
  gap: 14px;
}

.service-config-panel {
  margin-top: 18px;
}

.service-config-list {
  display: grid;
  gap: 12px;
}

.service-channel {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr 0.9fr auto auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcf9;
}

.service-channel > div {
  display: grid;
  gap: 6px;
  align-self: center;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}

.toggle-line input {
  width: auto;
  height: auto;
}

.reply-context {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  background: #eef5ff;
}

.reply-context h2 {
  font-size: 24px;
}

.order-item {
  grid-template-columns: 120px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
}

.task-row,
.publish-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.publish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.oneclick-panel {
  margin-bottom: 18px;
}

.account-panel {
  margin-bottom: 18px;
}

.account-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.2fr;
  gap: 12px;
  margin-bottom: 14px;
}

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

.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcf9;
}

.account-item div {
  display: grid;
  gap: 4px;
}

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

.oneclick-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.7fr repeat(3, 0.8fr);
  gap: 12px;
  margin-bottom: 14px;
}

.listing-desc {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.platform-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.platform-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: #fbfcf9;
}

.platform-checks input {
  width: auto;
  height: auto;
}

.listing-task-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.listing-task {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.publish-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.publish-tools select {
  width: 150px;
}

.settings-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.cost-panel {
  margin-top: 18px;
}

.cost-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.cost-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
}

.cost-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.cost-item b {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef3f0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ready {
  background: #e7f4ef;
  color: var(--mint-dark);
}

.status-pill.hold {
  background: #fff0df;
  color: #9a641c;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e2eae5;
  overflow: hidden;
}

.progress span,
.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mint);
}

.selected-product {
  align-self: start;
}

.selected-hero {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.selected-hero img {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: 8px;
}

.edit-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

.compliance-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #ead5b4;
  border-radius: 8px;
  background: #fff8ee;
}

.compliance-box b {
  color: #8b5c1d;
}

.compliance-box span {
  color: #775a35;
  font-size: 13px;
  line-height: 1.45;
}

.detail-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
}

.detail-head,
.detail-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-stats span {
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef3f0;
  color: var(--muted);
  font-size: 12px;
}

.gallery-section {
  display: grid;
  gap: 8px;
}

.gallery-section b {
  font-size: 13px;
}

.detail-thumbs,
.detail-images {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.detail-images {
  grid-template-columns: repeat(3, 1fr);
  max-height: 520px;
}

.detail-thumbs a,
.detail-images a {
  display: block;
}

.detail-thumbs img,
.detail-images img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #eef3f0;
}

.detail-images img {
  aspect-ratio: 3 / 4;
}

.detail-list {
  display: grid;
  gap: 6px;
}

.detail-list span,
.detail-error {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.detail-error {
  color: #a33b2f;
}

.ai-output {
  min-height: 370px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
}

.ai-block {
  display: none;
}

.ai-block.active {
  display: grid;
  gap: 12px;
}

.copy-line {
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  line-height: 1.6;
}

.prompt-tool {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d8e2dc;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(34, 50, 42, 0.12);
}

.prompt-main textarea {
  min-height: 210px;
  border: 0;
  background: #fff;
  font-size: 16px;
  line-height: 1.7;
  padding: 16px;
  box-shadow: none;
}

.prompt-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.title-workspace {
  align-items: start;
}

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

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

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

.title-source-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  color: var(--muted);
  font-size: 13px;
}

.title-result-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.title-result-card b {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

.title-result-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.title-history {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

.title-history-head b {
  color: var(--ink);
  font-size: 15px;
}

.title-history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.title-history-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.title-history-item b {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-history-item span {
  color: var(--muted);
  font-size: 12px;
}

.title-history-item.active {
  border-color: var(--blue);
  background: #edf5ff;
}

.simple-options {
  grid-template-columns: repeat(4, minmax(0, auto));
  justify-content: start;
  align-items: end;
  padding: 0 6px;
}

.simple-options label span {
  margin-bottom: 5px;
  font-size: 12px;
}

.simple-options select {
  width: auto;
  min-width: 112px;
  height: 34px;
  border-radius: 999px;
  padding: 0 28px 0 12px;
  background: #f6f8f5;
  font-size: 13px;
}

.prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 2px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.upload-btn input {
  display: none;
}

.media-uploader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed #bfcbc3;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcf9;
}

.media-uploader b,
.media-uploader span {
  display: block;
}

.media-uploader span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.media-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}

.media-preview:empty {
  display: none;
}

.mention-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.mention-bar.suggesting {
  margin-top: -4px;
  border: 1px solid #cfdad4;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(28, 43, 36, 0.16);
  color: var(--ink);
  z-index: 2;
}

.mention-chip {
  width: auto;
  height: 28px;
  border: 1px solid #cfdad4;
  border-radius: 999px;
  padding: 0 10px;
  background: #f6f8f5;
  color: var(--ink);
  cursor: pointer;
}

.mention-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mention-chip.active {
  border-color: rgba(35, 130, 95, 0.35);
  background: #eaf5ef;
  color: #166b4b;
}

.media-chip {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.media-remove {
  position: absolute;
  z-index: 2;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 27, 23, 0.75);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.media-chip img,
.media-chip video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f0;
}

.media-chip span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creative-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  justify-content: stretch;
  gap: 14px;
  min-height: 220px;
}

.creative-gallery > .muted,
.video-gallery > .muted {
  align-self: center;
  justify-self: center;
  max-width: 260px;
  text-align: center;
  line-height: 1.6;
}

.asset-card,
.creative-thumb {
  position: relative;
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fbfcf9;
}

.asset-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.asset-select {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
  cursor: pointer;
}

.asset-select input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.asset-select span {
  width: 14px;
  height: 14px;
  border: 2px solid #92a29b;
  border-radius: 4px;
  background: #fff;
}

.asset-select input:checked + span {
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: inset 0 0 0 3px #fff;
}

.asset-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.asset-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.pager-buttons {
  display: flex;
  gap: 8px;
}

.pager-buttons .ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost-btn.danger {
  color: #b42318;
}

.ghost-btn.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.asset-preview img,
.creative-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef3f0;
}

.asset-card b {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creative-thumb span,
.asset-card span,
.asset-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.asset-card span,
.asset-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 22px;
}

.asset-meta small {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  background: #f3f7f4;
}

.asset-prompt {
  display: -webkit-box;
  min-height: 30px;
  overflow: hidden;
  white-space: normal !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.text-btn {
  justify-self: start;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}

.video-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  justify-items: stretch;
  gap: 14px;
  min-height: 260px;
}

.video-item {
  width: 100%;
}

.video-item video,
.video-pending {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  background: #111b17;
  object-fit: cover;
}

.video-pending {
  display: grid;
  place-items: center;
  color: #dce8e1;
  min-height: 0;
  text-align: center;
  padding: 14px;
}

.video-item span,
.video-item small {
  color: var(--muted);
  line-height: 1.45;
}

.asset-dialog {
  width: min(920px, calc(100vw - 36px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
}

.asset-dialog::backdrop {
  background: rgba(10, 18, 15, 0.55);
}

.asset-dialog-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.asset-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.asset-dialog-head h3 {
  margin: 0;
}

.asset-dialog-body {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
}

.asset-dialog-media img,
.asset-dialog-media video,
.asset-dialog-media .video-pending {
  width: 100%;
  max-height: 520px;
  border-radius: 8px;
  object-fit: contain;
  background: #111b17;
}

.asset-dialog-info {
  display: grid;
  align-content: start;
  gap: 10px;
}

.asset-dialog-info div {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--muted);
}

.asset-dialog-info b {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.asset-dialog-info textarea {
  width: 100%;
  resize: vertical;
}

.bar {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 50px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e0e8e3;
}

@media (max-width: 1120px) {
  .product-grid,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collector-grid,
  .id-collector,
  .dashboard-layout,
  .studio-layout,
  .analytics-grid,
  .settings-grid,
  .service-layout,
  .service-channel,
  .ops-strip,
  .oneclick-grid,
  .analysis-grid,
  .analysis-head,
  .prompt-controls,
  .title-form,
  .cost-grid,
  .order-item {
    grid-template-columns: 1fr;
  }

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

  .image-workspace > .panel:first-child {
    max-width: none;
    padding-top: 12px;
    justify-self: stretch;
  }

  .image-workspace > .panel:last-child {
    max-width: none;
    justify-self: stretch;
    min-height: 0;
  }

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

  .simple-options select {
    width: 100%;
  }

  .title-result-card {
    grid-template-columns: 1fr;
  }

  .title-history-list {
    grid-template-columns: 1fr;
    max-height: 240px;
  }
}

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

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

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

  .nav-item {
    justify-content: center;
  }

  .nav-item b,
  .sidebar-foot {
    display: none;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .collector-grid {
    padding: 14px;
  }

  .creative-gallery,
  .video-gallery {
    grid-template-columns: 1fr;
  }

  .asset-dialog-body {
    grid-template-columns: 1fr;
  }
}
