.qr-studio,
.md-studio {
  max-width: 56rem;
}

.qr-catalog {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.qr-catalog button {
  border: 1px solid rgba(108, 207, 255, 0.35);
  background: rgba(15, 23, 41, 0.6);
  color: #e0e6ff;
  border-radius: 99px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.qr-catalog button.is-active {
  background: rgba(108, 207, 255, 0.2);
  border-color: #6cf;
}

.qr-grid-opts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.qr-stage-wrap {
  display: flex;
  justify-content: center;
  padding: 1.25rem;
  margin: 1rem 0;
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(224, 230, 255, 0.12);
  transition: transform 0.35s ease;
}

.qr-stage-wrap.qr-pulse {
  animation: qr-pulse 2.2s ease-in-out infinite;
}

@keyframes qr-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(108, 207, 255, 0.25); }
  50% { transform: scale(1.02); box-shadow: 0 0 24px 4px rgba(167, 139, 250, 0.35); }
}

.qr-stage-wrap.qr-aurora canvas,
.qr-stage-wrap.qr-aurora svg {
  animation: qr-aurora 9s linear infinite;
}

@keyframes qr-aurora {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(360deg); }
}

.qr-stage-wrap.qr-orbita canvas,
.qr-stage-wrap.qr-orbita svg {
  animation: qr-orbita 18s linear infinite;
}

@keyframes qr-orbita {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.qr-stage {
  min-width: 280px;
  min-height: 280px;
}

.qr-stage canvas,
.qr-stage svg {
  display: block;
  border-radius: 0.75rem;
  width: 280px;
  height: 280px;
  max-width: 100%;
}

.qr-actions > * {
  flex: 0 1 auto;
}

.qr-color-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.35rem 0 0.75rem;
}

.qr-color-toolbar .btn {
  flex: 0 1 auto;
}

.qr-colors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

.qr-color-field {
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(224, 230, 255, 0.12);
  background: rgba(10, 14, 39, 0.45);
}

.qr-color-field span {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
}

.qr-hex-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

input.qr-picker[type="color"] {
  width: 2.6rem !important;
  min-width: 2.6rem;
  height: 2.6rem;
  padding: 0.15rem !important;
  background: transparent;
  border-radius: 0.55rem;
  cursor: pointer;
  flex: none;
}

.qr-hex {
  width: 7.8rem !important;
  max-width: 100%;
  padding: 0.45rem 0.6rem !important;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.04em;
}

.qr-color-row {
  display: grid;
  grid-template-columns: repeat(8, 1.55rem);
  gap: 0.32rem;
}

.qr-swatch {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(224, 230, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  padding: 0;
  cursor: pointer;
}

.qr-swatch.is-claro {
  box-shadow: inset 0 0 0 1px rgba(15, 23, 41, 0.35);
}

.qr-swatch.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 2px #66ccff;
}

#qr-contraste.is-alerta {
  color: #fbbf24;
}

.md-open-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.md-open-row > * {
  flex: 0 1 auto;
}

.md-viewbar {
  margin: 1rem 0 0.45rem;
}

.md-tabs {
  display: flex;
  width: 100%;
  border: 1px solid rgba(224, 230, 255, 0.16);
  border-radius: 0.7rem;
  overflow: hidden;
}

.md-tabs button {
  flex: 1;
  border: 0;
  background: rgba(15, 23, 41, 0.55);
  color: #c7d2fe;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

.md-tabs button.is-active {
  background: rgba(108, 207, 255, 0.2);
  color: #fff;
}

.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.65rem;
}

.md-toolbar[hidden],
.md-editor-pane[hidden],
.md-preview-pane[hidden],
.tools-dash[hidden],
#tools-intro[hidden],
#tools-workspace[hidden] {
  display: none !important;
}

.md-toolbar button {
  min-width: 2.3rem;
  border: 1px solid rgba(224, 230, 255, 0.16);
  background: rgba(15, 23, 41, 0.7);
  color: #e0e6ff;
  border-radius: 0.45rem;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.md-toolbar button:hover,
.md-toolbar button:focus-visible {
  border-color: #66ccff;
}

.md-stage {
  margin: 0 0 1rem;
}

.md-code {
  position: relative;
  height: min(32rem, 72vh);
  min-height: 16rem;
  resize: vertical;
  overflow: hidden;
  border: 1px solid rgba(224, 230, 255, 0.16);
  border-radius: 0.8rem;
  background: #0b1022;
}

.md-code-hi,
.md-code textarea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 1rem 1.05rem;
  border: 0;
  border-radius: 0;
  box-sizing: border-box;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.5) transparent;
}

.md-code textarea::-webkit-scrollbar,
.md-code-hi::-webkit-scrollbar,
.md-preview::-webkit-scrollbar {
  width: 8px;
}

.md-code textarea::-webkit-scrollbar-thumb,
.md-preview::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.45);
  border-radius: 99px;
}

.md-code-hi {
  pointer-events: none;
  color: #c9d4f0;
  background: transparent;
}

.md-code textarea {
  z-index: 1;
  background: transparent !important;
  color: transparent !important;
  caret-color: #e8eefc !important;
  resize: none;
  min-height: 0;
}

.md-code textarea::selection {
  background: rgba(108, 207, 255, 0.28);
}

.md-tok-h { color: #93c5fd; font-weight: 700; }
.md-tok-strong { color: #f8fafc; font-weight: 700; }
.md-tok-em { color: #d8b4fe; font-style: italic; }
.md-tok-u { color: #fde68a; text-decoration: underline; }
.md-tok-strike { color: #94a3b8; text-decoration: line-through; }
.md-tok-code,
.md-tok-fence { color: #86efac; }
.md-tok-pre { color: #a5b4fc; }
.md-tok-quote { color: #64748b; }
.md-tok-link { color: #7dd3fc; }
.md-tok-table { color: #fdba74; }
.md-tok-hr { color: #64748b; }
.md-tok-li { color: #fde68a; }

@media (max-width: 700px) {
  .md-code {
    height: 18rem;
  }
}

.md-preview {
  padding: 1.25rem 1.2rem 1.8rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(224, 230, 255, 0.12);
  background: #10162c;
  min-height: 20rem;
  overflow: auto;
  color: #e8ecf8;
  font-size: 0.98rem;
  line-height: 1.65;
}

.md-preview > :first-child { margin-top: 0; }
.md-preview h1,
.md-preview h2,
.md-preview h3,
.md-preview h4 {
  line-height: 1.3;
  color: #f8fafc;
  font-weight: 700;
}
.md-preview h1 {
  font-size: 1.85rem;
  margin: 0 0 0.9rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(224, 230, 255, 0.14);
  letter-spacing: -0.02em;
}
.md-preview h2 { font-size: 1.35rem; margin: 1.55rem 0 0.5rem; }
.md-preview h3 { font-size: 1.12rem; margin: 1.2rem 0 0.4rem; }
.md-preview h4 { font-size: 1rem; margin: 1rem 0 0.35rem; }
.md-preview p { margin: 0 0 0.9rem; }
.md-preview a { color: #93c5fd; }
.md-preview strong { color: #fff; }
.md-preview code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: rgba(139, 92, 246, 0.2);
  padding: 0.12rem 0.38rem;
  border-radius: 0.3rem;
}
.md-preview pre {
  overflow-x: auto;
  padding: 0.9rem 1rem;
  border-radius: 0.65rem;
  background: #080c1c;
  border: 1px solid rgba(224, 230, 255, 0.1);
  margin: 0 0 1rem;
}
.md-preview pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: #d1fae5;
}
.md-preview blockquote {
  margin: 0.85rem 0 1.1rem;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 3px solid #60a5fa;
  color: #dbe4ff;
}
.md-preview blockquote > :last-child { margin-bottom: 0; }
.md-preview hr {
  border: 0;
  border-top: 1px solid rgba(224, 230, 255, 0.16);
  margin: 1.4rem 0;
}
.md-preview ul,
.md-preview ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}
.md-preview li { margin: 0.22rem 0; }
.md-preview li input[type="checkbox"] {
  margin-right: 0.4rem;
}
.md-preview img {
  max-width: 100%;
  border-radius: 0.5rem;
  display: block;
  margin: 0.6rem 0 1rem;
}
.md-table-wrap {
  overflow-x: auto;
  margin: 0.5rem 0 1.15rem;
  border: 1px solid rgba(224, 230, 255, 0.14);
  border-radius: 0.6rem;
}
.md-preview table {
  width: 100%;
  min-width: 28rem;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0;
}
.md-preview th,
.md-preview td {
  border-bottom: 1px solid rgba(224, 230, 255, 0.12);
  border-right: 1px solid rgba(224, 230, 255, 0.08);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.md-preview th {
  background: rgba(99, 102, 241, 0.18);
  font-weight: 650;
  color: #eef2ff;
}
.md-preview th:first-child,
.md-preview td:first-child {
  white-space: nowrap;
}
.md-preview tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}
.md-preview td:last-child,
.md-preview th:last-child {
  border-right: 0;
}

.md-templates,
.md-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.6rem 0 1rem;
}

.md-templates button,
.md-icons button {
  border: 1px solid rgba(224, 230, 255, 0.15);
  background: rgba(108, 207, 255, 0.08);
  color: #e0e6ff;
  border-radius: 0.5rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.md-icons button {
  font-size: 1.15rem;
  padding: 0.25rem 0.45rem;
}

.md-front {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.6rem;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.2);
  margin-bottom: 0.85rem;
}

.md-front div {
  display: grid;
  grid-template-columns: minmax(6.5rem, 28%) 1fr;
  gap: 0.4rem 0.75rem;
}

.md-front div span:first-child {
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
  padding-top: 0.15rem;
}

.md-front[hidden] {
  display: none !important;
}

.md-studio.is-drop {
  outline: 2px dashed #66ccff;
  outline-offset: 6px;
  border-radius: 0.75rem;
}

.md-gh-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.35rem 0 1rem;
  max-height: 9.5rem;
  overflow: auto;
}

.md-gh-lista button {
  border: 1px solid rgba(224, 230, 255, 0.15);
  background: rgba(15, 23, 41, 0.65);
  color: #c7d2fe;
  border-radius: 0.45rem;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.md-gh-lista button.is-active {
  border-color: #66ccff;
  color: #e0e6ff;
  background: rgba(108, 207, 255, 0.16);
}

.md-origen {
  font-size: 0.82rem;
  margin: 0 0 0.5rem;
}

.tools-dash {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.tools-cat-title {
  font-size: 1.05rem;
  margin: 0 0 0.7rem;
  color: #c7d2fe;
}

.tools-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
  background: #1a1f3a;
  border: 1px solid rgba(224, 230, 255, 0.1);
  border-radius: 1rem;
  padding: 0.95rem 1rem;
  min-height: 7.2rem;
}

.tool-card:hover,
.tool-card:focus-visible {
  border-color: #8b5cf6;
}

.tool-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.6rem;
  background: rgba(108, 207, 255, 0.12);
  font-size: 1.15rem;
}

.tool-card-name {
  font-size: 1rem;
}

.tool-card-desc {
  font-size: 0.85rem;
  opacity: 0.75;
  line-height: 1.35;
}

.tools-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  position: sticky;
  top: 0.4rem;
  z-index: 12;
  background: rgba(10, 14, 39, 0.92);
  padding: 0.4rem 0;
  backdrop-filter: blur(8px);
}

.tools-switch-home {
  text-decoration: none;
  color: #c7d2fe;
  border: 1px solid rgba(224, 230, 255, 0.2);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

.tools-switch-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(139, 92, 246, 0.55);
  background: #1a1f3a;
  color: inherit;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.tools-switch-btn span[data-tools-label] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tools-switch-icon,
.tools-pick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.45rem;
  background: rgba(108, 207, 255, 0.14);
  flex: none;
  font-size: 0.95rem;
}

.tools-switch-caret {
  margin-left: auto;
  opacity: 0.7;
}

.tools-dlg {
  width: min(28rem, calc(100% - 1.25rem));
  max-height: min(84vh, 40rem);
  border: 1px solid rgba(224, 230, 255, 0.16);
  border-radius: 1.05rem;
  background: #12172e;
  color: inherit;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.tools-dlg[open] {
  display: flex;
  flex-direction: column;
  animation: tools-dlg-in 0.18s ease;
}

@keyframes tools-dlg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.tools-dlg::backdrop {
  background: rgba(5, 8, 20, 0.72);
  backdrop-filter: blur(4px);
}

.tools-dlg-handle {
  display: none;
}

.tools-dlg-bar {
  flex: none;
  z-index: 2;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid rgba(224, 230, 255, 0.1);
  background: #161b35;
}

.tools-dlg.is-scrolled .tools-dlg-bar {
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
}

.tools-dlg-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.tools-dlg-title-row strong {
  font-size: 1.05rem;
}

.tools-dlg-close {
  flex: none;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  border: 1px solid rgba(224, 230, 255, 0.16);
  background: rgba(15, 23, 41, 0.7);
  color: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.tools-dlg-close:hover,
.tools-dlg-close:focus-visible {
  border-color: #66ccff;
}

.tools-dlg-search {
  display: block;
}

.tools-dlg-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.tools-dlg-search input {
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(224, 230, 255, 0.16);
  background: #0a0e27;
  color: inherit;
  font: inherit;
}

.tools-dlg-search input:focus {
  outline: 2px solid rgba(108, 207, 255, 0.55);
  outline-offset: 1px;
  border-color: #66ccff;
}

.tools-dlg-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.35rem 0.75rem 1.15rem;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.55) transparent;
}

.tools-dlg-body::-webkit-scrollbar {
  width: 8px;
}

.tools-dlg-body::-webkit-scrollbar-button {
  display: none;
  height: 0;
  width: 0;
}

.tools-dlg-body::-webkit-scrollbar-track {
  background: transparent;
  margin: 0.5rem 0;
}

.tools-dlg-body::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.45);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.tools-dlg-body::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.75);
  background-clip: padding-box;
}

.tools-pick-cat {
  margin: 0;
}
.tools-pick-cat:first-child .tools-pick-kicker {
  margin-top: 0.2rem;
}

.tools-pick-kicker {
  margin: 0.55rem 0.15rem 0.4rem;
  padding: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: #a5b4fc;
}

.tools-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
}

.tools-pick {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  background: rgba(15, 23, 41, 0.7);
  border: 1px solid rgba(224, 230, 255, 0.1);
  border-radius: 0.7rem;
  padding: 0.55rem 0.7rem;
}

.tools-pick.is-active {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.16);
}

.tools-pick:hover,
.tools-pick:focus-visible {
  border-color: #66ccff;
}

.tools-pick-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.tools-pick-text strong {
  font-size: 0.95rem;
}

.tools-pick-text span {
  font-size: 0.82rem;
  opacity: 0.75;
  line-height: 1.3;
}

.tools-dlg-empty {
  margin: 1.4rem 0.5rem;
  text-align: center;
  opacity: 0.75;
  font-size: 0.92rem;
}

.tools-pick[hidden],
.tools-pick-cat[hidden],
.tools-dlg-empty[hidden] {
  display: none !important;
}

.tools-workspace-body .tool-panel h2:first-child {
  margin-top: 0.2rem;
}

@media (max-width: 900px) {
  .tools-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tools-cards {
    grid-template-columns: 1fr;
  }
  .tool-card {
    min-height: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.7rem;
  }
  .tool-card-name {
    flex: 1 1 8rem;
  }
  .tool-card-desc {
    flex: 1 1 100%;
  }
  .tools-dlg {
    width: 100%;
    max-height: min(92dvh, 42rem);
    margin: auto 0 0;
    border-radius: 1.1rem 1.1rem 0 0;
  }
  .tools-dlg[open] {
    animation: tools-dlg-up 0.22s ease;
  }
  @keyframes tools-dlg-up {
    from { transform: translateY(18%); }
    to { transform: none; }
  }
  .tools-dlg-handle {
    display: block;
    width: 2.6rem;
    height: 0.28rem;
    border-radius: 99px;
    background: rgba(224, 230, 255, 0.28);
    margin: 0.45rem auto 0;
  }
  .tools-dlg-body {
    padding-bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  }
  .md-open-row .btn,
  .md-open-row .btn-ghost {
    flex: 1 1 calc(50% - 0.5rem);
    text-align: center;
  }
}