:root {
  --bg: #f4efe9;
  --bg-soft: #fbf7f2;
  --card: rgba(255, 255, 255, 0.84);
  --card-strong: #ffffff;
  --text: #241f1c;
  --muted: rgba(36, 31, 28, 0.64);
  --line: rgba(36, 31, 28, 0.12);
  --shadow: 0 24px 70px rgba(51, 36, 25, 0.14);
  --radius: 28px;
  --radius-small: 16px;
  --accent: #9e5b4b;
  --accent-dark: #723b30;
  --danger: #b83232;
  --green: #376b45;
  --blue: #395f8f;
  --pink: #b94471;
  --black: #161616;
  --gold: #a97825;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(158, 91, 75, 0.22), transparent 34%),
    radial-gradient(circle at bottom right, rgba(57, 95, 143, 0.14), transparent 38%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 5.2rem);
  line-height: 0.9;
  letter-spacing: -0.07em;
}

.subtitle {
  max-width: 660px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-pill,
.small-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.compose-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.15fr) minmax(280px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.media-panel,
.composer-panel,
.status-panel {
  padding: 20px;
}

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

.panel-header h2 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 470px;
  border: 2px dashed rgba(36, 31, 28, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.42)),
    var(--bg-soft);
  overflow: hidden;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  transform: translateY(-2px);
  background:
    linear-gradient(135deg, rgba(158, 91, 75, 0.14), rgba(255, 255, 255, 0.58)),
    var(--bg-soft);
}

.file-input {
  display: none;
}

.empty-preview {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 2.6rem;
  font-weight: 300;
  line-height: 1;
}

.empty-preview h3 {
  margin: 10px 0 0;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

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

.preview-wrap {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 470px;
  background: #111;
}

.preview-wrap img,
.preview-wrap video {
  width: 100%;
  height: 100%;
  max-height: 640px;
  object-fit: contain;
  background: #111;
}

.file-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.file-details > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.detail-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.file-details strong {
  max-width: 60%;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-label {
  display: block;
  margin: 16px 0 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

textarea,
input[type="text"],
input[type="url"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  outline: none;
  padding: 14px 15px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

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

textarea:focus,
input[type="text"]:focus,
input[type="url"]:focus {
  border-color: rgba(158, 91, 75, 0.62);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(158, 91, 75, 0.12);
}

.helper-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

#caption-warning {
  color: var(--danger);
  text-align: right;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.platform-fieldset {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.platform-fieldset legend {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

.platform-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.platform-option:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.9);
}

.platform-option input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.platform-option strong {
  display: block;
  margin-bottom: 2px;
}

.platform-option small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.platform-option:has(input:checked) {
  background: #fff;
}

.platform-option.instagram:has(input:checked) {
  border-color: rgba(185, 68, 113, 0.48);
  box-shadow: 0 0 0 4px rgba(185, 68, 113, 0.09);
}

.platform-option.facebook:has(input:checked) {
  border-color: rgba(57, 95, 143, 0.48);
  box-shadow: 0 0 0 4px rgba(57, 95, 143, 0.09);
}

.platform-option.pinterest:has(input:checked) {
  border-color: rgba(184, 50, 50, 0.48);
  box-shadow: 0 0 0 4px rgba(184, 50, 50, 0.09);
}

.platform-option.x:has(input:checked) {
  border-color: rgba(22, 22, 22, 0.48);
  box-shadow: 0 0 0 4px rgba(22, 22, 22, 0.09);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 850;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 28px rgba(114, 59, 48, 0.2);
}

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

.secondary-button {
  background: var(--text);
  color: #fff;
}

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

.text-button {
  min-height: auto;
  background: transparent;
  color: var(--muted);
  padding: 6px 0;
}

.text-button.danger {
  color: var(--danger);
}

.primary-button.wide {
  flex: 1;
  min-width: 170px;
}

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

.summary-box {
  display: grid;
  gap: 10px;
}

.summary-item {
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.62);
}

.summary-item span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-item strong {
  word-break: break-word;
}

.platform-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.platform-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

.platform-chip.instagram {
  background: var(--pink);
}

.platform-chip.facebook {
  background: var(--blue);
}

.platform-chip.pinterest {
  background: var(--danger);
}

.platform-chip.x {
  background: var(--black);
}

.status-log {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.status-message {
  padding: 12px 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  color: var(--text);
  line-height: 1.45;
}

.status-message.success {
  border-color: rgba(55, 107, 69, 0.3);
  background: rgba(55, 107, 69, 0.09);
}

.status-message.error {
  border-color: rgba(184, 50, 50, 0.3);
  background: rgba(184, 50, 50, 0.09);
}

.status-message.warning {
  border-color: rgba(169, 120, 37, 0.3);
  background: rgba(169, 120, 37, 0.1);
}

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

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

  .status-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding: 16px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .topbar h1 {
    font-size: 3rem;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .compose-grid {
    grid-template-columns: 1fr;
  }

  .media-panel,
  .composer-panel,
  .status-panel {
    padding: 16px;
  }

  .drop-zone,
  .preview-wrap {
    min-height: 340px;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .button-row {
    flex-direction: column;
  }

  .primary-button.wide,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }
}
