/* 种草批量合成控制台 — 深色主题 + 绿色强调 */
:root {
  --bg: #0f1419;
  --bg2: #1a222d;
  --surface: #243040;
  --text: #e8edf4;
  --muted: #8b9aaf;
  --accent: #34d399;
  --accent-dim: #059669;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-email {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.view {
  display: none;
  animation: fade 0.2s ease;
}

.view.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.panel.narrow {
  max-width: 400px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.panel h1 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.lead {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
textarea {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  margin-top: 0.5rem;
}

.btn:hover {
  border-color: rgba(52, 211, 153, 0.35);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent-dim), #047857);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
}

.btn.sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.85rem;
  margin-top: 0;
}

.btn.danger {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar h1 {
  margin: 0;
  font-size: 1.35rem;
}

.toolbar.row {
  justify-content: flex-start;
}

.inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.inline input {
  width: 5rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.table th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.2);
}

.table tbody tr:hover {
  background: rgba(52, 211, 153, 0.04);
}

.actions {
  white-space: nowrap;
}

.dur-input {
  width: 5.2rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.crumb {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--muted);
}

.crumb a {
  color: var(--accent);
  text-decoration: none;
}

.crumb a:hover {
  text-decoration: underline;
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.banner.warn {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.tabs button {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg2);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.tabs button.active {
  background: var(--surface);
  color: var(--accent);
  border-color: rgba(52, 211, 153, 0.35);
}

.tab-panel {
  margin-bottom: 1.5rem;
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 0.75rem;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
  max-width: 720px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

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

/* 画面库：放大预览卡，并固定 9:16 全显示（不裁切） */
#image-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

#image-grid .card.asset img {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  display: block;
  background: #000;
}

#image-grid .card.asset .ph {
  width: 100%;
  aspect-ratio: 9 / 16;
  height: auto;
  background: #000;
}

.card.asset {
  background: var(--bg2);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card.asset img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

.card.asset .ph {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.card.asset .meta {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.card.asset .row {
  padding: 0 0.5rem 0.5rem;
}

.clip {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag,
.badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.tag.ok {
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent);
}

.tag.bad {
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca;
}

.toasts {
  position: fixed;
  right: 1rem;
  top: 4rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 20rem;
  pointer-events: none;
}

.toast {
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.toast.err {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.82rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

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

.main-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.main-nav a {
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--accent);
  background: rgba(52, 211, 153, 0.1);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.stat-card .num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-card .lbl {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.chart-wrap {
  overflow-x: auto;
  padding: 0.5rem 0 1rem;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 180px;
  padding-bottom: 1.5rem;
}

.chart-bar-group {
  flex: 1;
  min-width: 18px;
  max-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.chart-bar-group .bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.85), rgba(5, 150, 105, 0.4));
  min-height: 2px;
  transition: height 0.2s ease;
}

.chart-bar-group .bar2 {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.8), rgba(37, 99, 235, 0.35));
  min-height: 2px;
}

.chart-bar-group .lab {
  font-size: 0.65rem;
  color: var(--muted);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  max-height: 4rem;
  white-space: nowrap;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.ops-card {
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.ops-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.ops-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.ops-card.warn {
  border-color: rgba(251, 191, 36, 0.35);
}

.modal {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 0;
  background: var(--bg2);
  color: var(--text);
  max-width: min(420px, 92vw);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal-form {
  padding: 1.25rem;
}

.modal-form h3 {
  margin: 0 0 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.lightbox-dlg {
  max-width: min(960px, 96vw);
  padding: 0;
  border: none;
  background: #000;
}

.lightbox-dlg::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.lightbox-dlg img,
.lightbox-dlg video {
  display: block;
  max-width: 100%;
  max-height: 86vh;
  margin: 0 auto;
}

.lb-close {
  position: absolute;
  right: 0.5rem;
  top: 0.35rem;
  z-index: 2;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

.lightbox-dlg {
  position: relative;
}

.card.asset img {
  cursor: zoom-in;
}

#video-grid .card.asset video {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  display: block;
  background: #000;
}

.preview-video-wrap {
  max-width: 220px;
}

.preview-video-wrap video {
  width: 100%;
  max-height: 120px;
  border-radius: 6px;
  background: #000;
}

.crumb .btn.sm {
  margin-left: 0.35rem;
  vertical-align: middle;
}

#dash-days {
  margin-left: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg);
  color: var(--text);
}

.panel.soft {
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.h3-sm {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.clone-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.clone-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.toolbar.row-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

select.sm {
  max-width: 11rem;
  font-size: 0.85rem;
}

.muted.sm {
  font-size: 0.85rem;
}
