:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f4f6f8;
  color: #202833;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

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

button {
  touch-action: manipulation;
}

a {
  color: inherit;
}

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

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: #607080;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(29px, 4vw, 42px);
}

h2 {
  font-size: 18px;
}

.stats {
  min-width: 128px;
  padding: 12px 14px;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #fff;
  text-align: right;
}

.stats span {
  display: block;
  font-size: 28px;
  font-weight: 850;
}

.stats small {
  color: #607080;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(520px, 100%);
  margin-bottom: 16px;
  padding: 5px;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #fff;
}

.tab-button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #607080;
  cursor: pointer;
  font-weight: 850;
}

.tab-button.active {
  background: #2364aa;
  color: #fff;
}

.tab-panel {
  display: none;
}

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

.panel {
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #fff;
}

.save-layout {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(320px, 1fr);
  grid-template-areas:
    "quick viewer"
    "recent recent";
  gap: 14px;
  align-items: start;
}

.quick-save {
  grid-area: quick;
}

.viewer-panel {
  grid-area: viewer;
}

.recent-panel {
  grid-area: recent;
}

.quick-save,
.viewer-panel,
.recent-panel,
.idea-form,
.idea-list-panel,
.list-panel {
  padding: 14px;
}

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

.quick-form,
.idea-form {
  display: grid;
  gap: 13px;
}

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

.field-wide {
  grid-column: 1 / -1;
}

label {
  color: #516170;
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd7df;
  border-radius: 7px;
  padding: 10px 11px;
  background: #fbfcfd;
  color: #202833;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid #cbe7ff;
  border-color: #3277b5;
}

.platform-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.platform-option {
  display: block;
}

.platform-option input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.platform-option span,
.platform-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 42px;
  min-height: 38px;
  border: 1px solid #d3dbe2;
  border-radius: 8px;
  background: #f8fafb;
  color: #253241;
  font-size: 13px;
  font-weight: 850;
}

.platform-option input:checked + span {
  border-color: #2364aa;
  background: #e8f1fb;
  color: #174d7f;
}

.platform-icon {
  width: 44px;
  height: 36px;
  flex: 0 0 44px;
}

[data-platform="youtube"] {
  background: #ffecec;
  border-color: #f0b2b2;
  color: #b91c1c;
}

[data-platform="instagram"] {
  background: #fff0f6;
  border-color: #efb5cf;
  color: #a21caf;
}

[data-platform="facebook"] {
  background: #edf4ff;
  border-color: #b8d3f5;
  color: #1d4ed8;
}

[data-platform="tiktok"] {
  background: #eefdf9;
  border-color: #a5e9dd;
  color: #0f766e;
}

[data-platform="vimeo"] {
  background: #e9f8ff;
  border-color: #acd9ec;
  color: #0369a1;
}

[data-platform="x"] {
  background: #eef0f3;
  border-color: #ccd2d9;
  color: #111827;
}

.optional-fields {
  border: 1px solid #e0e6ec;
  border-radius: 8px;
  background: #fbfcfd;
}

.optional-fields summary {
  padding: 10px 11px;
  cursor: pointer;
  color: #516170;
  font-size: 13px;
  font-weight: 800;
}

.optional-grid {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 12px;
  padding: 0 11px 11px;
}

.primary {
  border: 0;
  border-radius: 7px;
  min-height: 42px;
  padding: 11px 14px;
  background: #2364aa;
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

.save-cta {
  min-height: 50px;
  font-size: 16px;
}

.primary:hover {
  background: #1b528d;
}

.message {
  min-height: 20px;
  margin: 0;
  color: #2f6f4e;
  font-size: 14px;
}

.viewer-head h2 {
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.viewer-box {
  display: grid;
  min-height: 248px;
  border: 1px dashed #cfd7df;
  border-radius: 8px;
  background: #fbfcfd;
  place-items: center;
  overflow: hidden;
}

.viewer-box p {
  margin: 0;
  padding: 16px;
  color: #607080;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
}

.viewer-placeholder {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
  padding: 18px;
}

.viewer-placeholder .platform-icon {
  width: 56px;
}

.viewer-box iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 170px 150px;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.compact-list,
.link-list,
.idea-list {
  display: grid;
  gap: 10px;
}

.compact-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.link-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px;
  border: 1px solid #e1e6ea;
  border-radius: 8px;
  background: #fff;
}

.compact-card {
  background: #fbfcfd;
}

.title-row {
  display: flex;
  gap: 10px;
  align-items: start;
}

.link-title {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.link-url {
  display: block;
  color: #2364aa;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.meta,
.tags,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.meta {
  margin-top: 10px;
  color: #607080;
  font-size: 13px;
}

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 750;
}

.badge {
  background: #e8f1fb;
  color: #1d5a91;
}

.tag {
  background: #eef2e5;
  color: #556b2f;
}

.notes {
  margin: 10px 0 0;
  color: #3c4856;
  line-height: 1.45;
  white-space: pre-wrap;
}

.actions {
  justify-content: flex-end;
  align-content: start;
  min-width: 192px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfd7df;
  border-radius: 7px;
  min-width: 48px;
  height: 36px;
  padding: 0 10px;
  background: #fbfcfd;
  color: #202833;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.icon-btn.small {
  min-width: 48px;
  height: 32px;
}

.icon-btn:hover {
  background: #edf4f8;
}

.danger {
  color: #a82323;
}

.danger:hover {
  border-color: #d66a6a;
  background: #fff0f0;
}

.empty {
  padding: 42px 12px;
  color: #607080;
  text-align: center;
}

.idea-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 430px) 1fr;
  gap: 14px;
  align-items: start;
}

.idea-form {
  position: sticky;
  top: 14px;
}

.idea-form-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
}

.idea-filters {
  grid-template-columns: 1fr 160px;
}

.idea-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e1e6ea;
  border-radius: 8px;
  background: #fff;
}

.idea-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.idea-card h2 {
  font-size: 19px;
  overflow-wrap: anywhere;
}

.idea-actions,
.image-actions,
.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.idea-actions {
  justify-content: flex-end;
}

.idea-hook {
  margin: 0;
  color: #174d7f;
  font-weight: 750;
  line-height: 1.45;
}

.script-preview {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid #dfe5ea;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
  color: #202833;
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.idea-image {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 9px;
  border: 1px solid #dfe5ea;
  border-radius: 8px;
  background: #fbfcfd;
}

.idea-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid #e1e6ea;
  background: #eef2f5;
}

.idea-image figcaption {
  display: grid;
  gap: 2px;
}

.idea-image strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.idea-image span,
.image-empty {
  color: #607080;
  font-size: 12px;
}

.image-empty {
  margin: 0;
}

.image-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.image-actions .danger {
  grid-column: span 2;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding-top: 14px;
    padding-bottom: 88px;
  }

  .app-header,
  .save-layout,
  .idea-workspace,
  .link-card {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: stretch;
  }

  .save-layout {
    grid-template-areas:
      "quick"
      "viewer"
      "recent";
  }

  .tabs {
    position: fixed;
    z-index: 10;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    margin: 0;
    box-shadow: 0 8px 24px rgba(32, 40, 51, 0.18);
  }

  .idea-form {
    position: static;
  }

  .filters,
  .idea-filters,
  .idea-form-row,
  .idea-card-head,
  .optional-grid {
    grid-template-columns: 1fr;
  }

  .compact-list {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-width: 0;
  }

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

  .icon-btn {
    min-width: 0;
    width: 100%;
    padding: 0 6px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: calc(100% - 14px);
  }

  .stats {
    text-align: left;
  }

  .quick-save,
  .viewer-panel,
  .recent-panel,
  .idea-form,
  .idea-list-panel,
  .list-panel {
    padding: 11px;
  }

  .platform-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .actions .danger {
    grid-column: span 2;
  }

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