:root {
  color-scheme: light;
  --cream: #fffdf8;
  --surface: #ffffff;
  --navy: #142b54;
  --blue: #2f6fef;
  --red: #e8412e;
  --yellow: #f6b52c;
  --teal: #14a79a;
  --ink-soft: rgba(20, 43, 84, 0.68);
  --line: rgba(20, 43, 84, 0.13);
  --shadow: 0 18px 42px rgba(20, 43, 84, 0.11);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--navy);
  background:
    linear-gradient(135deg, rgba(47, 111, 239, 0.10), transparent 32%),
    linear-gradient(315deg, rgba(20, 167, 154, 0.12), transparent 34%),
    var(--cream);
}

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

button {
  min-height: 44px;
  border: 0;
  border-radius: 16px;
  padding: 10px 16px;
  font-weight: 900;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.primary {
  color: #fff;
  background: var(--navy);
  box-shadow: 0 10px 22px rgba(20, 43, 84, 0.20);
}

.secondary {
  color: var(--navy);
  background: #fff;
  border: 2px solid var(--line);
}

.danger {
  color: #fff;
  background: var(--red);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(16px);
}

.app-header h1,
.app-header p {
  margin: 0;
}

.eyebrow {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 22px;
  width: min(1440px, calc(100% - 32px));
  margin: 22px auto 48px;
}

.sidebar,
.workspace {
  min-width: 0;
}

.panel,
.workspace,
.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

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

.panel h2,
.section-head h2 {
  margin: 0 0 8px;
}

.hint,
.section-head p,
.status {
  color: var(--ink-soft);
}

.status.is-error {
  color: var(--red);
}

.status.is-success {
  color: #107c55;
}

label {
  display: grid;
  gap: 7px;
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  border: 2px solid rgba(20, 43, 84, 0.12);
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--navy);
  background: #fff;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(47, 111, 239, 0.68);
  box-shadow: 0 0 0 4px rgba(47, 111, 239, 0.10);
}

.summary-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.summary-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.summary-list div:last-child {
  border-bottom: 0;
}

.summary-list dt {
  color: var(--ink-soft);
  font-weight: 800;
}

.summary-list dd {
  margin: 0;
  font-weight: 1000;
}

.workspace {
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(238, 245, 248, 0.62);
}

.tab {
  color: var(--ink-soft);
  background: transparent;
}

.tab.is-active {
  color: #fff;
  background: var(--blue);
}

.tab-panel {
  display: none;
  padding: 22px;
}

.tab-panel.is-active {
  display: block;
}

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

.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.pexels-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(238, 245, 248, 0.52);
}

.pexels-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.pexels-result {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pexels-result img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(238, 245, 248, 0.72);
}

.pexels-credit {
  min-height: 2.8em;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.stack {
  display: grid;
  gap: 14px;
}

.item-card {
  padding: 16px;
}

.image-card {
  display: grid;
  gap: 14px;
}

.image-preview {
  display: grid;
  place-items: center;
  min-height: 180px;
  overflow: hidden;
  border: 2px dashed rgba(20, 43, 84, 0.16);
  border-radius: 8px;
  color: var(--ink-soft);
  background: rgba(238, 245, 248, 0.58);
  font-weight: 900;
}

.image-preview img {
  width: 100%;
  height: 220px;
  object-fit: contain;
}

.card-fields,
.path-grid {
  display: grid;
  gap: 12px;
}

.path-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.raw-json {
  min-height: 58svh;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (max-width: 880px) {
  .app-header,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: stretch;
  }

  .header-actions button,
  .section-head button {
    width: 100%;
  }

  .app-shell,
  .path-grid,
  .pexels-search {
    grid-template-columns: 1fr;
  }
}
