/* ---------- reset & base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  background: #0e1116;
  color: #d6dae0;
}
a { color: #7aa7ff; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; margin: 0 0 8px; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
p { margin: 0 0 8px; }
.muted { color: #7a838f; font-weight: 400; }

/* ---------- layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: #161b22;
  border-bottom: 1px solid #232a33;
}
.brand {
  font-weight: 600;
  color: #d6dae0;
  font-size: 14px;
}
.project-id {
  margin-left: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #7a838f;
  font-size: 12px;
}
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
}
.section-title {
  margin: 24px 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a838f;
}
.empty {
  color: #7a838f;
  font-style: italic;
}

/* ---------- card ---------- */
.card {
  background: #161b22;
  border: 1px solid #232a33;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.create-card { max-width: 520px; }

/* ---------- forms ---------- */
input[type=text], input[type=number], textarea, select {
  background: #0e1116;
  color: #d6dae0;
  border: 1px solid #2c343f;
  border-radius: 4px;
  padding: 6px 8px;
  font: inherit;
}
input[type=text]:focus, input[type=number]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #4d7fd6;
}
input[type=file] {
  color: #d6dae0;
}
textarea { resize: vertical; width: 100%; }
button, .button {
  background: #4d7fd6;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 14px;
  font: inherit;
  cursor: pointer;
  display: inline-block;
}
button:hover, .button:hover { background: #3f6cc1; text-decoration: none; color: #fff; }
button:disabled { background: #2c343f; color: #7a838f; cursor: not-allowed; }
button.ghost {
  background: transparent;
  color: #d6dae0;
  border: 1px solid #2c343f;
  padding: 2px 8px;
}
button.tiny { padding: 2px 6px; font-size: 12px; }
button.danger, .danger { background: #9b3535; }
button.danger:hover { background: #832b2b; }
.inline { display: inline; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input[type=text] { flex: 1; }

/* ---------- projects list ---------- */
.project-list { list-style: none; padding: 0; margin: 0; }
.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.project-name {
  font-size: 16px;
  font-weight: 600;
  color: #d6dae0;
}
.project-meta {
  color: #7a838f;
  font-size: 12px;
  margin-top: 2px;
}

/* ---------- project detail header ---------- */
.project-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.project-header h1 { margin: 0; flex: 1; }
.back { font-size: 13px; color: #7a838f; }

/* ---------- three columns ---------- */
.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 16px;
  align-items: flex-start;
}
.col { min-width: 0; }

/* ---------- images ---------- */
.upload-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.thumb {
  background: #0e1116;
  border: 1px solid #2c343f;
  border-radius: 4px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.thumb.selected { border-color: #4d7fd6; }
.thumb img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}
.thumb-name {
  font-size: 11px;
  color: #7a838f;
  word-break: break-all;
}

/* ---------- texts ---------- */
.texts-form { margin-bottom: 12px; }
.texts-form textarea { margin-bottom: 6px; }
.text-list { list-style: none; padding: 0; margin: 0; max-height: 420px; overflow-y: auto; }
.text-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #1c232c;
}
.text-item.selected .text-text { color: #fff; font-weight: 500; }
.text-item.inactive .text-text { color: #5b6470; text-decoration: line-through; }
.text-text {
  flex: 1;
  font-size: 13px;
  color: #d6dae0;
  cursor: pointer;
  display: block;
  padding: 2px 4px;
  border-radius: 3px;
}
.text-text:hover { background: #1f2731; text-decoration: none; }

/* ---------- template + preview ---------- */
.preview {
  width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid #2c343f;
  margin-bottom: 12px;
  display: block;
}
.preview-placeholder {
  background: #0e1116;
  border: 1px dashed #2c343f;
  border-radius: 4px;
  padding: 40px;
  text-align: center;
  color: #7a838f;
  margin-bottom: 12px;
}
.template-form fieldset {
  border: 1px solid #2c343f;
  border-radius: 4px;
  padding: 8px 12px 12px;
  margin: 0 0 12px;
}
.template-form legend {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7a838f;
  padding: 0 4px;
}
.template-form label {
  display: inline-flex;
  flex-direction: column;
  font-size: 12px;
  color: #7a838f;
  margin: 4px 8px 4px 0;
}
.template-form label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: #d6dae0;
  font-size: 13px;
}
.template-form input[type=text],
.template-form input[type=number],
.template-form select {
  margin-top: 2px;
  width: 110px;
}

/* ---------- generation ---------- */
.generation .status {
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px 0 12px;
  font-size: 13px;
}
.status-idle    { background: #1c232c; color: #7a838f; }
.status-progress { background: #243a52; color: #cce1ff; }
.status-ok      { background: #1f3b2b; color: #b1e4c4; }
.status-error   { background: #3b1f1f; color: #e4b1b1; }
.generation-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.errors { margin-top: 12px; }
.errors summary { cursor: pointer; color: #e4b1b1; }
.errors ul { margin: 6px 0 0 18px; padding: 0; color: #b8929a; font-size: 12px; }
