:root {
  --bg: #f6f1e8;
  --bg-deep: #eadfcd;
  --panel: rgba(255, 251, 245, 0.86);
  --panel-strong: rgba(255, 248, 240, 0.95);
  --line: rgba(94, 68, 38, 0.12);
  --line-strong: rgba(94, 68, 38, 0.2);
  --text: #25160a;
  --muted: #785b3e;
  --accent: #0d7c66;
  --accent-strong: #095a4a;
  --accent-soft: rgba(13, 124, 102, 0.12);
  --orange: #f28b38;
  --orange-soft: rgba(242, 139, 56, 0.15);
  --shadow: 0 24px 60px rgba(68, 43, 19, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 212, 174, 0.55), transparent 32%),
    linear-gradient(180deg, #faf6f0 0%, #f1e5d6 100%);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.bg-orb {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(14px);
  opacity: 0.72;
  pointer-events: none;
}

.orb-a {
  width: 320px;
  height: 320px;
  top: -80px;
  right: 8%;
  background: rgba(242, 139, 56, 0.18);
}

.orb-b {
  width: 420px;
  height: 420px;
  bottom: -140px;
  left: -120px;
  background: rgba(13, 124, 102, 0.15);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(112, 80, 47, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(112, 80, 47, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 82%);
  pointer-events: none;
}

.shell {
  position: relative;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 22px;
  padding: 24px;
  min-height: 100vh;
}

.panel,
.card {
  position: relative;
  backdrop-filter: blur(20px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.controls-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 20px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 62px;
  height: 62px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--orange), #ffcf8e);
  color: #fff7ef;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(242, 139, 56, 0.28);
}

.brand-block h1,
.hero h2,
.section-head h2,
.gallery-empty h3,
.media-title {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

.brand-block h1 {
  margin: 0;
  font-size: 2rem;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
}

.card {
  padding: 18px;
}

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

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-head.compact h2,
.hero h2 {
  margin: 0;
}

.section-head.compact h2 {
  font-size: 1.1rem;
}

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

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

.field span,
.mini-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.field input:focus,
.field select:focus {
  border-color: rgba(13, 124, 102, 0.44);
  box-shadow: 0 0 0 4px rgba(13, 124, 102, 0.09);
  transform: translateY(-1px);
}

.field-grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.advanced-box {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.38);
}

.advanced-box summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-strong);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease, background 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #22a182);
  color: #f7fff9;
  box-shadow: 0 14px 26px rgba(13, 124, 102, 0.2);
}

.btn-secondary {
  background: linear-gradient(135deg, #f5d8b9, #f0bb7d);
  color: #4b2500;
  box-shadow: 0 14px 26px rgba(242, 139, 56, 0.18);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  border: 1px solid var(--line);
}

.badge,
.selection-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.badge-muted {
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  border: 1px solid var(--line);
}

.badge-ok {
  background: rgba(13, 124, 102, 0.12);
  color: var(--accent-strong);
  border: 1px solid rgba(13, 124, 102, 0.2);
}

.badge-error {
  background: rgba(209, 75, 75, 0.1);
  color: #9c3030;
  border: 1px solid rgba(209, 75, 75, 0.18);
}

.summary-text {
  line-height: 1.55;
  color: var(--muted);
}

.mini-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  padding: 22px;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -20px;
  width: 220px;
  height: 220px;
  border-radius: 36px;
  background: linear-gradient(145deg, rgba(13, 124, 102, 0.16), rgba(242, 139, 56, 0.18));
  transform: rotate(18deg);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  gap: 12px;
  min-width: 420px;
}

.metric-card {
  position: relative;
  z-index: 1;
  padding: 16px;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.metric-card span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.metric-card strong {
  font-size: 1.9rem;
  font-family: "Space Grotesk", sans-serif;
}

.toolbar-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-group.right {
  align-items: center;
}

.selection-pill {
  background: var(--orange-soft);
  color: #5d2d03;
}

.selection-pill strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
}

.gallery-empty {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 52px 22px;
}

.empty-art {
  width: 92px;
  height: 92px;
  border-radius: 32px;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(13, 124, 102, 0.22), rgba(242, 139, 56, 0.26)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.45));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}

.gallery-empty p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.media-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 26px;
  background: rgba(255, 251, 245, 0.84);
  border: 1px solid var(--line);
  box-shadow: 0 22px 42px rgba(63, 42, 22, 0.08);
  overflow: hidden;
}

.media-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 140px;
  height: 140px;
  border-radius: 32px;
  transform: rotate(18deg);
  background: linear-gradient(135deg, rgba(242, 139, 56, 0.12), rgba(13, 124, 102, 0.12));
}

.media-card.selected {
  border-color: rgba(13, 124, 102, 0.34);
  box-shadow: 0 26px 48px rgba(13, 124, 102, 0.16);
  transform: translateY(-2px);
}

.media-topline {
  display: flex;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.kind-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kind-post {
  background: rgba(39, 111, 185, 0.12);
  color: #1d4f91;
}

.kind-story {
  background: rgba(242, 139, 56, 0.14);
  color: #8a5000;
}

.kind-highlight {
  background: rgba(121, 82, 179, 0.12);
  color: #5b3894;
}

.media-check {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
}

.media-check input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.media-check span {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 18px rgba(25, 17, 8, 0.12);
}

.media-check input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
}

.media-check input:checked + span::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 13px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
  top: 6px;
  left: 10px;
}

.media-thumb-wrap {
  position: relative;
  z-index: 1;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(214, 224, 225, 0.7), rgba(247, 234, 213, 0.8));
}

.media-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-meta {
  position: relative;
  z-index: 1;
}

.media-title {
  margin: 0 0 6px;
  font-size: 1.08rem;
}

.media-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.log-panel {
  padding: 18px;
}

.log-feed {
  margin-top: 16px;
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
}

.log-line {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(111, 82, 53, 0.08);
  color: #4f3923;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

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

  .controls-panel {
    position: relative;
    top: 0;
    max-height: none;
  }

  .hero {
    flex-direction: column;
  }

  .hero-metrics {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 740px) {
  .shell {
    padding: 16px;
    gap: 16px;
  }

  .toolbar-panel,
  .mini-stat-row,
  .field-grid.two {
    grid-template-columns: 1fr;
    display: grid;
  }

  .toolbar-group.right {
    justify-content: space-between;
  }

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

  .media-card {
    padding: 12px;
    border-radius: 22px;
  }
}
