* { box-sizing: border-box; }

:root {
  --bg: #edf3f8;
  --panel: #ffffff;
  --line: #d6e0ec;
  --text: #14213d;
  --muted: #607089;
  --orange: #ff6333;
  --blue: #2e398b;
  --green: #00a859;
  --shadow: 0 18px 50px rgba(21, 37, 64, .08);
  --radius: 18px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 15px;
}

a { color: inherit; text-decoration: none; }

button, .ghost-btn {
  border: 0;
  background: var(--orange);
  color: white;
  font-weight: 900;
  border-radius: 12px;
  padding: 11px 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover, .ghost-btn:hover { filter: brightness(.97); }

.ghost-btn {
  background: white;
  border: 1px solid var(--line);
  color: var(--text);
}

.app-shell {
  max-width: 1840px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 230px minmax(720px, 1fr) 260px;
  gap: 18px;
  padding: 16px;
}

.leftbar, .rightbar {
  position: sticky;
  top: 16px;
  align-self: start;
}

.brand-mini, .side-card, .panel, .hero-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand-mini {
  padding: 16px;
  margin-bottom: 12px;
}

.brand-mini strong { display: block; font-size: 18px; }
.brand-mini span { color: var(--muted); font-size: 13px; }

nav {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 12px;
}

nav a, .pill-link {
  display: block;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 7px;
  font-weight: 800;
}

nav a.active {
  border-color: var(--orange);
  color: var(--orange);
  background: #fff7f4;
}

.side-card {
  padding: 12px;
  margin-bottom: 12px;
}

.side-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

.main {
  min-width: 0;
}

.hero-panel {
  padding: 18px 20px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.hero-panel h1 {
  margin: 7px 0 6px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: .98;
  letter-spacing: -1.4px;
}

.hero-panel p, .panel p {
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tag {
  display: inline-flex;
  background: #e7fff1;
  color: #04733e;
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
}

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

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2, .panel h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -.6px;
}

.section-head p {
  margin: 4px 0 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 900;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.bulk-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}

.bulk-actions {
  display: flex;
  gap: 10px;
  margin: 10px 0 16px;
}

button.danger {
  background: #fff;
  color: #b42318;
  border: 1px solid #ffb4a5;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 16px;
}

.image-card {
  position: relative;
  background: white;
  border: 1px solid var(--line);
  border-radius: 17px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(21,37,64,.06);
}

.image-preview {
  background: #e8eef6;
  padding: 12px;
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: white;
}

.full-ai-preview img {
  max-height: 360px;
  object-fit: contain;
}

.select-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  flex-direction: row;
  align-items: center;
  font-weight: 900;
}

.image-info {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.image-info strong { display: block; }
.image-info span { color: var(--muted); }

.score {
  background: #e9fff3;
  color: #008a4c;
  padding: 6px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.regen-form {
  padding: 13px 14px 8px;
}

.regen-form textarea {
  min-height: 82px;
  margin: 8px 0;
}

.regen-form button {
  width: 100%;
}

.delete-btn {
  margin: 0 14px 12px;
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

details {
  padding: 0 14px 14px;
}

summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--muted);
}

pre {
  white-space: pre-wrap;
  overflow: auto;
  background: #0f172a;
  color: #dbeafe;
  padding: 12px;
  border-radius: 12px;
  font-size: 12px;
}

.empty-box {
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 900;
}

.thumb-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.thumb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px;
}

.thumb-row img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: white;
  border-radius: 8px;
}

.thumb-row button {
  padding: 7px 9px;
  background: white;
  color: #b42318;
  border: 1px solid #ffb4a5;
}

.job {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 8px;
}

.job div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.job progress {
  width: 100%;
  accent-color: var(--orange);
}

.job p {
  margin: 5px 0 0;
  color: var(--muted);
}

.job.failed {
  border-color: #ffb4a5;
}

.copy-field {
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 12px 0;
  overflow: hidden;
  background: #f8fafc;
}

.copy-field > div {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.copy-field textarea {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  min-height: 120px;
}

.project-list a, .brand-card {
  display: block;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}

.project-list span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.brand-grid, .asset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

.brand-card span {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  margin-bottom: 10px;
}

.asset-grid article {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
}

.asset-grid img {
  width: 100%;
  aspect-ratio: 1.4;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 12px;
}

.asset-upload {
  display: grid;
  grid-template-columns: 260px 1fr auto;
  gap: 10px;
  margin-bottom: 16px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  background: white;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h1 { margin: 0; }
.login-card p { color: var(--muted); }

.muted { color: var(--muted); }

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 1350px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .rightbar {
    grid-column: 2;
    position: static;
  }

  .image-grid {
    grid-template-columns: repeat(2, minmax(230px, 1fr));
  }
}

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

  .leftbar, .rightbar {
    position: static;
  }

  .image-grid, .form-grid, .brand-grid, .asset-grid, .asset-upload {
    grid-template-columns: 1fr;
  }

  .hero-panel, .section-head {
    flex-direction: column;
  }
}

.cancel-job-btn {
  width: 100%;
  margin-top: 8px;
  background: #ffffff;
  color: #b42318;
  border: 1px solid #ffb4a5;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 900;
}

.full-ai-preview {
  min-height: 260px;
}

.full-ai-preview img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  background: #ffffff;
}

.job-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.cancel-job-btn,
.clear-job-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 900;
}

.cancel-job-btn {
  background: #ffffff;
  color: #b42318;
  border: 1px solid #ffb4a5;
}

.clear-job-btn {
  background: #ffffff;
  color: #14213d;
  border: 1px solid #d6e0ec;
}

.bulk-form-js {
  margin-bottom: 16px;
}
