
:root { --bg: #0a0a0f; --surface: #14141c; --surface-2: #1c1c28; --border: #2a2a3a; --text: #f0f0f5; --text-dim: #9090a8; --accent: #ff3b6b; --accent-2: #ff6b3b; --blue: #4a9eff; --green: #4ade80; --gold: #ffd700; --purple: #a78bfa; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Bai Jamjuree', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }

.topbar { position: sticky; top: 0; z-index: 100; background: rgba(10,10,15,0.9); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.brand { font-size: 18px; font-weight: 700; }
.brand a { color: inherit; text-decoration: none; }
.back-btn { padding: 6px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); text-decoration: none; font-size: 13px; }
.back-btn:hover { background: var(--border); }

.layout { display: grid; grid-template-columns: 320px 1fr; gap: 0; min-height: calc(100vh - 57px); }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 20px; overflow-y: auto; max-height: calc(100vh - 57px); }
.sidebar h3 { font-size: 12px; color: var(--text-dim); text-transform: uppercase; margin: 16px 0 8px; letter-spacing: 0.05em; }
.sidebar h3:first-child { margin-top: 0; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.field select, .field input, .field textarea { width: 100%; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: inherit; font-size: 12px; }
.field select:focus, .field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { min-height: 70px; resize: vertical; font-family: inherit; line-height: 1.4; }

.section { background: var(--bg); padding: 20px 28px; border-bottom: 1px solid var(--border); }
.section h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; padding-left: 10px; border-left: 3px solid var(--accent); }
.product-card { display: flex; gap: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.product-card img { width: 100px; height: 100px; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.product-card .info { flex: 1; min-width: 0; }
.product-card .name { font-size: 15px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.product-card .meta { font-size: 12px; color: var(--text-dim); }
.product-card .price { font-size: 20px; color: var(--accent); font-weight: 700; margin-top: 6px; }
.product-card .badges { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.product-card .badge { padding: 3px 8px; background: var(--surface-2); border-radius: 4px; font-size: 10px; font-weight: 500; }
.tiktok-meta { margin-top: 12px; padding: 10px 12px; background: rgba(74,158,255,0.08); border: 1px solid rgba(74,158,255,0.45); border-radius: 8px; }
.tiktok-meta[hidden] { display: none; }
.tiktok-title { color: var(--blue); font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.tiktok-row { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 8px; align-items: start; margin-top: 7px; }
.tiktok-label { color: var(--text-dim); font-size: 11px; padding-top: 5px; }
.tiktok-value { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.tiktok-value code, .tiktok-value a { min-width: 0; flex: 1; color: var(--text); font-family: 'SF Mono', Consolas, monospace; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; word-break: break-word; }
.tiktok-value a { color: #8ec5ff; text-decoration: underline; }
.copy-btn { flex: 0 0 auto; padding: 4px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font-family: inherit; font-size: 10px; cursor: pointer; white-space: nowrap; }
.copy-btn:hover { background: var(--border); }
.copy-btn.copied { border-color: var(--green); color: var(--green); }

.prompt-box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-top: 12px; }
.prompt-box pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-family: 'SF Mono', monospace; font-size: 11px; line-height: 1.6; color: var(--green); white-space: pre-wrap; word-break: break-word; max-height: 500px; overflow-y: auto; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 14px; background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-family: inherit; font-size: 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.vo-line { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.vo-line .time { width: 50px; color: var(--gold); font-family: monospace; font-size: 11px; }
.vo-line .speaker { width: 70px; color: var(--blue); font-size: 11px; font-weight: 600; }
.vo-line input { flex: 1; padding: 6px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: inherit; font-size: 12px; }
.vo-line .del { background: transparent; border: none; color: var(--red); cursor: pointer; padding: 4px 8px; }
.add-vo { padding: 6px 12px; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 6px; color: var(--text-dim); cursor: pointer; font-size: 11px; width: 100%; }
.add-vo:hover { background: var(--border); color: var(--text); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.btn { padding: 10px 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: inherit; font-size: 13px; cursor: pointer; transition: all 0.15s; }
.btn:hover { background: var(--border); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; border: none; font-weight: 600; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,59,107,0.3); }
.btn-gold { background: var(--gold); color: #000; border: none; font-weight: 600; }

.empty { text-align: center; padding: 80px 20px; color: var(--text-dim); }
.empty .icon { font-size: 64px; margin-bottom: 16px; opacity: 0.5; }

.note { background: rgba(74,158,255,0.1); border: 1px solid var(--blue); border-radius: 8px; padding: 10px 14px; font-size: 12px; margin: 12px 0; color: var(--text); }
.note strong { color: var(--blue); }
.note.warn { background: rgba(255,215,0,0.1); border-color: var(--gold); }
.note.warn strong { color: var(--gold); }

.toast { position: fixed; bottom: 20px; right: 20px; z-index: 2000; background: var(--surface-2); border: 1px solid var(--border); padding: 12px 20px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.toast.success { border-color: var(--green); }

.char-count { font-size: 10px; color: var(--text-dim); text-align: right; margin-top: 2px; }
.char-count.warn { color: var(--gold); }
.char-count.over { color: var(--red); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  .tiktok-row { grid-template-columns: 1fr; gap: 3px; }
}
