@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@500;600;700;800&display=swap");

:root {
  --bg: #f4f7fb;
  --bg-strong: #eef3ff;
  --panel: #ffffff;
  --line: #dbe3f0;
  --line-strong: #c5d4ef;
  --ink: #0e1b3d;
  --muted: #5f6f8f;
  --brand: #2d66f6;
  --brand-strong: #214ac7;
  --brand-soft: #edf2ff;
  --danger: #be123c;
  --danger-soft: #ffe4ea;
  --ok: #047857;
  --warn: #a16207;
  --shadow: 0 18px 40px rgba(28, 57, 125, 0.11);
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(1200px 480px at 68% -150px, #d9e6ff 0, transparent 70%),
    linear-gradient(180deg, var(--bg-strong), var(--bg));
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
}

.studio-topbar {
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.studio-brand {
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: "Sora", "Manrope", sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #5f88ff);
  color: #fff;
  font-size: 0.78rem;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.env-chip {
  font-size: 0.74rem;
  font-weight: 700;
  color: #1d4ed8;
  background: #e8efff;
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
}

.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.role-chip,
.perm-chip {
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.26rem 0.6rem;
  background: #fff;
  color: #334155;
}

.role-chip.superadmin {
  background: #e8efff;
  border-color: #b7caf8;
  color: #1d4ed8;
}

.role-chip.editor {
  background: #edf8ff;
  border-color: #b8dff8;
  color: #0369a1;
}

.role-chip.viewer {
  background: #f8fafc;
  color: #475569;
}

.perm-chip.disabled {
  opacity: 0.5;
}

.perm-chip.enabled {
  border-color: #b7e2cf;
  background: #ecfdf3;
  color: #067647;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.studio-shell {
  display: grid;
  grid-template-columns: 350px minmax(460px, 1fr) 390px;
  gap: 0.9rem;
  padding: 0.95rem;
}

.studio-sidebar,
.studio-inspector {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.studio-canvas {
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 0.9rem;
}

.panel h2 {
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1.14rem;
}

.panel h3 {
  margin: 0.7rem 0 0.45rem;
  font-size: 0.98rem;
}

.panel-text {
  margin: 0.38rem 0 0.74rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

label {
  display: block;
  margin: 0.42rem 0 0.22rem;
  font-size: 0.81rem;
  font-weight: 700;
  color: #344054;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  padding: 0.57rem 0.68rem;
  font: inherit;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #8cb0ff;
  box-shadow: 0 0 0 2px #dbe7ff;
}

.row {
  display: flex;
  gap: 0.52rem;
  align-items: center;
  flex-wrap: wrap;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: "Sora", "Manrope", sans-serif;
  font-weight: 700;
  cursor: pointer;
  padding: 0.57rem 0.88rem;
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

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

.btn.small {
  padding: 0.43rem 0.66rem;
  font-size: 0.79rem;
}

.btn.primary {
  background: linear-gradient(130deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: 0 12px 24px rgba(45, 102, 246, 0.25);
}

.btn.soft {
  background: #fff;
  border-color: var(--line);
  color: #223553;
}

.btn.danger {
  background: var(--danger-soft);
  border-color: #fecdd3;
  color: var(--danger);
}

.session-box summary {
  cursor: pointer;
  font-weight: 700;
  color: #334155;
  margin-top: 0.56rem;
}

.status {
  min-height: 1.2rem;
  margin-top: 0.5rem;
  color: #475569;
  font-size: 0.88rem;
}

.status.ok {
  color: var(--ok);
}

.status.error {
  color: #b42318;
}

.element-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.element-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfdff, #f4f8ff);
  text-align: left;
  padding: 0.72rem;
  font-family: "Sora", "Manrope", sans-serif;
  font-weight: 600;
  cursor: grab;
}

.dropzone {
  border: 1px dashed #a7bee9;
  border-radius: 12px;
  background: #f9fbff;
  min-height: 108px;
  padding: 0.8rem;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 0.45rem;
}

.dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dropzone.drag-over {
  border-color: var(--brand);
  background: #eaf0ff;
}

.media-list {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.48rem;
}

.media-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem;
  background: #fbfdff;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: center;
}

.media-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.media-item strong {
  display: block;
  font-size: 0.84rem;
}

.sortable-list,
.flow-list {
  display: grid;
  gap: 0.5rem;
}

.sortable-item,
.flow-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faff;
  padding: 0.62rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.56rem;
}

.flow-item.selected {
  border-color: #7fa2fb;
  box-shadow: 0 0 0 1px #7fa2fb inset;
}

.drag-handle {
  color: #64748b;
  user-select: none;
  cursor: grab;
  font-weight: 700;
  font-family: "Sora", "Manrope", sans-serif;
}

.item-main strong {
  display: block;
  font-size: 0.9rem;
}

.item-main span {
  color: var(--muted);
  font-size: 0.8rem;
}

.subhead {
  font-size: 0.96rem;
}

.brand-grid,
.auth-links-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.46rem;
}

.auth-links-grid {
  margin-top: 0.4rem;
}

.input-with-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: center;
}

.dynamic-editor {
  display: grid;
  gap: 0.58rem;
  margin-top: 0.7rem;
}

.media-input .row {
  margin-top: 0.35rem;
}

.collection {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
  padding: 0.56rem;
}

.collection-item {
  border: 1px solid #dde6f6;
  border-radius: 10px;
  padding: 0.5rem;
  margin-bottom: 0.42rem;
  background: #fff;
}

.collection-item:last-child {
  margin-bottom: 0;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.82rem;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 1460px) {
  .studio-shell {
    grid-template-columns: 320px minmax(380px, 1fr) 350px;
  }
}

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

@media (max-width: 860px) {
  .studio-topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

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