:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #f3f7f5;
  --ink: #1f2933;
  --muted: #65727e;
  --line: #dbe1e6;
  --accent: #1e8a7a;
  --accent-dark: #12665a;
  --warn: #b42318;
  --shadow: 0 18px 45px rgba(34, 47, 62, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(30, 138, 122, 0.08), transparent 35%),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto 20px;
  max-width: 1480px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.auth-panel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-status {
  color: var(--muted);
  font-size: 0.95rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(420px, 1fr) minmax(260px, 320px);
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
}

.tool-column,
.preview-column,
.library-column {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-column {
  overflow: hidden;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
}

.mode-tab {
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  min-height: 46px;
  padding: 10px;
  font-weight: 700;
}

.mode-tab.active {
  background: var(--surface);
  color: var(--accent-dark);
}

.panel {
  display: none;
  padding: 18px;
}

.panel.active {
  display: block;
}

.field-stack {
  display: grid;
  gap: 8px;
}

label {
  color: var(--ink);
  font-weight: 700;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 150px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

select {
  min-height: 42px;
  margin-top: 7px;
  padding: 0 10px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.primary-button,
.ghost-button,
.icon-button,
.placeholder-tools button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.ghost-button,
.icon-button,
.placeholder-tools button {
  background: #fff;
  color: var(--ink);
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.2rem;
}

.hidden {
  display: none !important;
}

.status-line {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-line.error,
.empty-state.error {
  color: var(--warn);
}

.upload-drop {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  border: 2px dashed #b8c7c2;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 20px;
  text-align: center;
}

.upload-drop input {
  max-width: 100%;
}

.upload-drop span {
  font-size: 1.1rem;
}

.upload-drop small {
  color: var(--muted);
  font-weight: 500;
}

.placeholder-tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.preview-column {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  min-height: 720px;
  padding: 18px;
}

.preview-header,
.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.preview-canvas {
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, #edf1f4 25%, transparent 25%),
    linear-gradient(-45deg, #edf1f4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #edf1f4 75%),
    linear-gradient(-45deg, transparent 75%, #edf1f4 75%),
    #fff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  color: var(--muted);
  padding: 18px;
}

.preview-canvas svg,
.preview-canvas img {
  display: block;
  width: min(100%, 560px);
  height: min(100%, 560px);
  max-height: 62vh;
  object-fit: contain;
}

.plan-panel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.plan-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.palette-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

.library-column {
  padding: 18px;
}

.asset-list {
  display: grid;
  gap: 8px;
}

.asset-row {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  text-align: left;
}

.asset-row:hover {
  border-color: var(--accent);
}

.asset-name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-column {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .auth-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .option-grid,
  .mode-tabs,
  .placeholder-tools {
    grid-template-columns: 1fr;
  }

  .preview-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

.review-panel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.defect-list {
  list-style: none;
  margin: 10px 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.defect {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

.defect-severity {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.08);
}

.defect-major .defect-severity {
  background: rgba(220, 80, 80, 0.22);
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
