.templatical-composer {
  min-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}

.templatical-composer .builder-head {
  position: relative;
  z-index: 4;
}

.templatical-toolbar-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted, #68766d);
  font-size: 12px;
}

.templatical-toolbar-note::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #1e684e;
  box-shadow: 0 0 0 3px rgba(30, 104, 78, .12);
}

.templatical-editor-shell {
  min-height: 0;
  height: auto;
  overflow: hidden;
  border: 1px solid rgba(23, 35, 28, .12);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(23, 35, 28, .08);
}

#templatical-editor {
  width: 100%;
  height: 100%;
  min-height: 0;
  --tpl-user-font-family: "DM Sans", system-ui, sans-serif;
}

.templatical-loading,
.templatical-error {
  height: 100%;
  min-height: 520px;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 32px;
  text-align: center;
  color: #68766d;
}

.templatical-error strong { color: #8f2f2f; }

.templatical-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 430px;
  overflow: auto;
}

.templatical-media-card {
  border: 1px solid rgba(23, 35, 28, .12);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.templatical-media-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.templatical-media-card strong,
.templatical-media-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.templatical-preflight-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.templatical-preflight-stats > div {
  padding: 14px;
  border-radius: 12px;
  background: #f6f4ef;
}

.templatical-preflight-stats strong,
.templatical-preflight-stats span { display: block; }

@media (max-width: 900px) {
  .templatical-composer { min-height: calc(100vh - 24px); grid-template-rows: auto auto minmax(560px, 1fr); }
  .templatical-editor-shell { min-height: 560px; height: auto; border-radius: 10px; }
  .templatical-preflight-stats { grid-template-columns: 1fr; }
}
