* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f4f4f2;
  color: #222;
}
header.topbar {
  background: #1b1b1b;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
header.topbar .brand {
  font-size: 17px;
  font-weight: 600;
}
header.topbar .brand span {
  color: #e24b4a;
}
header.topbar nav a {
  color: #ddd;
  text-decoration: none;
  margin-left: 18px;
  font-size: 14px;
}
header.topbar nav a:hover,
header.topbar nav a.active {
  color: #fff;
  border-bottom: 2px solid #e24b4a;
}
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 18px;
}
.card {
  background: #fff;
  border: 1px solid #e2e0db;
  border-radius: 10px;
  padding: 18px 20px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1b1b1b;
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: #333; }
.btn.secondary {
  background: #fff;
  color: #1b1b1b;
  border: 1px solid #ccc;
}
.btn.secondary:hover { background: #f0f0f0; }
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #888;
}
.empty-state code {
  background: #eee;
  padding: 2px 6px;
  border-radius: 4px;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.template-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #eee;
}
.template-thumb img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.template-thumb.selected {
  border-color: #e24b4a;
}
.template-thumb p {
  margin: 0;
  font-size: 12px;
  padding: 6px 8px;
  color: #555;
}
.editor-layout {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.canvas-wrap {
  background: #ddd;
  border-radius: 10px;
  padding: 10px;
  flex-shrink: 0;
}
#posterCanvas {
  display: block;
  max-width: 100%;
  border-radius: 4px;
  cursor: grab;
}
.controls {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.field label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}
.field input[type=text] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}
.field input[type=range] { width: 100%; }
.field input[type=color] {
  width: 44px;
  height: 30px;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0;
}
.divider {
  border-top: 1px solid #e2e0db;
  margin: 4px 0;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.gallery-item {
  background: #fff;
  border: 1px solid #e2e0db;
  border-radius: 10px;
  overflow: hidden;
}
.gallery-item img {
  width: 100%;
  display: block;
}
.gallery-item .meta {
  padding: 8px 10px;
  font-size: 12px;
  color: #666;
}
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border: 1px solid #e2e0db;
  border-radius: 10px;
  padding: 16px;
}
.stat-card .label { font-size: 12px; color: #888; }
.stat-card .value { font-size: 26px; font-weight: 600; margin-top: 4px; }
table.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.report-table th, table.report-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
}
