/* Workspace width, generated-key copy access, and stable key-row actions */
#docsWorkspace {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}
#docsWorkspace .docs-hero,
#docsWorkspace .docs-toolbar,
#docsWorkspace .docs-toc,
#docsWorkspace .docs-content-grid,
#docsWorkspace .docs-footer {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
#docsWorkspace .docs-content-grid {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}
#docsWorkspace .docs-topic,
#docsWorkspace .docs-topic-wide {
  grid-column: 1;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.key-list-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 0;
}
.key-list-head-actions .secondary-btn {
  width: auto;
  white-space: nowrap;
}
.key-copy-list-button:disabled {
  opacity: .42;
  cursor: not-allowed;
  filter: saturate(.55);
}
.panel-key-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  justify-content: initial;
  gap: 7px;
  min-width: 0;
}
.panel-key-actions > button,
.panel-key-actions > .panel-key-action-placeholder {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.panel-key-actions > button {
  padding-inline: 6px;
  white-space: normal;
  line-height: 1.25;
}
.panel-key-action-placeholder {
  display: block;
  min-height: 36px;
  visibility: hidden;
  pointer-events: none;
}
@media (max-width: 700px) {
  #docsWorkspace .docs-content-grid { grid-template-columns: minmax(0, 1fr); }
  .key-list-head { align-items: flex-start; }
  .key-list-head-actions { flex-wrap: wrap; justify-content: flex-end; }
  .key-list-head-actions .secondary-btn { min-height: 38px; padding-inline: 9px; font-size: .61rem; }
  .panel-key-actions { gap: 6px; }
  .panel-key-actions > button { min-height: 36px; padding-inline: 5px; font-size: .6rem; }
}
@media (max-width: 420px) {
  .key-list-head { flex-direction: column; }
  .key-list-head-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .key-list-head-actions .secondary-btn { width: 100%; min-width: 0; }
  .panel-key-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panel-key-actions > button { font-size: .56rem; padding-inline: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  #docsWorkspace .docs-topic { transition: none !important; }
}

/* Keep all dashboard tabs at identical button dimensions across layouts. */
#dashboardNav {
  display: grid;
  grid-auto-rows: minmax(58px, auto);
  align-items: stretch;
}
#dashboardNav > .dashboard-tab {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  height: 100%;
  box-sizing: border-box;
  justify-self: stretch;
  align-self: stretch;
}
#dashboardNav > .dashboard-tab > span:last-child {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}
#scriptsWorkspace,
#docsWorkspace {
  width: 100%;
  max-width: none;
  min-width: 0;
  align-self: stretch;
  box-sizing: border-box;
}
#docsWorkspace .docs-hero,
#docsWorkspace .docs-toolbar,
#docsWorkspace .docs-toc,
#docsWorkspace .docs-content-grid,
#docsWorkspace .docs-footer {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}

/* Generated keys are individually readable and independently copyable. */
.generated-keys-panel {
  min-width: 0;
}
.generated-keys-source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.generated-keys-copy-all {
  flex: 0 0 auto;
}
.generated-key-items {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.generated-key-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(102, 226, 182, .12);
  border-radius: 11px;
  background: rgba(5, 10, 13, .38);
}
.generated-key-value {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #c8f6e1;
  font: 600 .67rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  user-select: text;
}
.generated-key-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid rgba(102, 226, 182, .22);
  border-radius: 9px;
  background: rgba(102, 226, 182, .09);
  color: #a8f0d0;
  font: 800 .65rem Inter, system-ui, sans-serif;
  cursor: pointer;
}
.generated-key-copy:hover,
.generated-keys-copy-all:hover {
  filter: brightness(1.12);
}
.generated-key-copy:focus-visible,
.generated-keys-copy-all:focus-visible {
  outline: 2px solid #89e9c1;
  outline-offset: 2px;
}
@media (max-width: 700px) {
  #dashboardNav > .dashboard-tab {
    min-height: 56px;
  }
  .generated-key-item {
    gap: 7px;
    padding: 9px;
  }
  .generated-key-copy {
    min-width: 63px;
    min-height: 40px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .generated-key-copy,
  .generated-keys-copy-all {
    transition: none !important;
  }
}


/* Reliable individual key-copy actions and mobile clipboard fallback. */
.panel-key-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.panel-key-copy-plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(102, 226, 182, .22);
  border-radius: 8px;
  background: rgba(102, 226, 182, .09);
  color: #a8f0d0;
  font: 750 .61rem Inter, system-ui, sans-serif;
  cursor: pointer;
}
.panel-key-copy-plain:disabled,
.generated-key-copy:disabled,
.generated-keys-copy-all:disabled { opacity: .65; cursor: wait; }
.clipboard-fallback-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  background: rgba(3, 5, 12, .82);
  backdrop-filter: blur(8px);
}
.clipboard-fallback-card {
  display: grid;
  gap: 12px;
  width: min(100%, 520px);
  max-height: 88dvh;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(169, 155, 255, .25);
  border-radius: 18px;
  background: #101321;
  color: #f0f1fb;
  box-shadow: 0 22px 80px rgba(0, 0, 0, .45);
}
.clipboard-fallback-card > strong { font-size: 1rem; }
.clipboard-fallback-card > p { margin: 0; color: #a8aec2; font-size: .82rem; line-height: 1.6; }
.clipboard-fallback-card > textarea {
  width: 100%;
  min-width: 0;
  min-height: 115px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 10px;
  background: #080b13;
  color: #e9fff5;
  font:  .76rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  user-select: text;
  -webkit-user-select: text;
  resize: vertical;
}
.clipboard-fallback-actions { display: flex; gap: 8px; justify-content: flex-end; }
.clipboard-fallback-actions button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid rgba(169, 155, 255, .25);
  border-radius: 9px;
  background: rgba(169, 155, 255, .1);
  color: #e5ddff;
  font: 750 .76rem Inter, system-ui, sans-serif;
}
.clipboard-fallback-actions button:last-child { background: rgba(255, 255, 255, .045); color: #d3d6e4; }
@media (max-width: 480px) {
  .generated-keys-head { display: grid; grid-template-columns: minmax(0, 1fr); }
  .generated-keys-copy-all { width: 100%; min-height: 42px; }
  .generated-key-item { grid-template-columns: minmax(0, 1fr) auto; }
  .generated-key-copy { min-width: 78px; min-height: 42px; }
  .clipboard-fallback-card { padding: 15px; border-radius: 15px; }
}


/* Panel Builder preview viewport controls and responsive canvas improvements. */
.preview-heading-tools{display:flex;align-items:center;justify-content:flex-end;gap:9px;flex:0 0 auto;flex-wrap:wrap}
.panel-preview-device-switch{display:inline-flex;align-items:center;gap:3px;padding:3px;border:1px solid rgba(170,157,255,.16);border-radius:11px;background:rgba(4,6,13,.5)}
.panel-preview-device-switch button{min-height:31px;padding:0 10px;border:1px solid transparent;border-radius:8px;background:transparent;color:#9da3b8;font:750 .62rem Inter,system-ui,sans-serif;cursor:pointer;transition:background-color .16s ease,color .16s ease,border-color .16s ease}
.panel-preview-device-switch button.is-active{border-color:rgba(169,155,255,.24);background:rgba(153,126,255,.15);color:#f0ecff}
.panel-preview-device-switch button:focus-visible{outline:2px solid #9e8cff;outline-offset:2px}
.panel-preview-stage{contain:layout style;transition:background-color .16s ease,padding .16s ease}
.panel-preview-stage[data-preview-mode="mobile"]{padding:18px 10px;background:linear-gradient(145deg,rgba(17,20,34,.88),rgba(7,9,16,.96));border:1px solid rgba(166,156,255,.12);border-radius:16px}
.panel-preview-stage[data-preview-mode="mobile"] #panelPreview{width:min(100%,390px);max-width:390px;min-height:620px;margin-inline:auto;padding:16px 13px;border:5px solid #202437;border-radius:28px;box-shadow:0 18px 38px rgba(0,0,0,.34),inset 0 0 0 1px rgba(255,255,255,.05)}
.panel-preview-stage[data-preview-mode="mobile"] .preview-hero{margin-top:34px;margin-bottom:26px}
.panel-preview-stage[data-preview-mode="mobile"] .preview-hero h2{font-size:clamp(1.9rem,8vw,2.55rem)}
.panel-preview-stage[data-preview-mode="mobile"] .preview-feature-grid{grid-template-columns:minmax(0,1fr);gap:7px}
.panel-preview-stage[data-preview-mode="mobile"] .preview-feature-grid article{display:grid;grid-template-columns:27px minmax(0,1fr);column-gap:8px;padding:10px}
.panel-preview-stage[data-preview-mode="mobile"] .preview-feature-grid article>span{grid-row:span 2}
.panel-preview-stage[data-preview-mode="mobile"] .preview-feature-grid article strong{margin-top:0}
.panel-preview-stage[data-preview-mode="mobile"] .preview-key-row{flex-direction:column}
.panel-preview-stage[data-preview-mode="mobile"] .preview-key-row button{width:100%}
.generated-key-copy{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.clipboard-fallback-overlay{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;overscroll-behavior:contain}
.clipboard-fallback-card{max-height:calc(100dvh - 30px);width:min(100%,560px);padding:clamp(14px,3.8vw,20px);}
.clipboard-fallback-card>textarea{min-height:128px;font-size:16px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere;}
.clipboard-fallback-actions button{touch-action:manipulation;min-height:44px;}
@media(max-width:700px){
 .preview-heading-tools{width:100%;justify-content:space-between}
 .panel-preview-device-switch{flex:0 0 auto}
 .panel-preview-device-switch button{min-width:74px;min-height:37px;font-size:.68rem}
 .panel-preview-stage[data-preview-mode="mobile"]{padding:10px 6px}
 .panel-preview-stage[data-preview-mode="mobile"] #panelPreview{min-height:580px}
 .panel-preview-stage[data-preview-mode="mobile"] .preview-hero{margin-top:25px;margin-bottom:22px}
}
@media(prefers-reduced-motion:reduce){.panel-preview-stage,.panel-preview-device-switch button{transition:none!important}}

.panel-key-copy-plain.is-recovery-limited{border-color:rgba(255,190,98,.26);background:rgba(255,190,98,.055);color:#ffd69d}.panel-key-copy-plain:focus-visible{outline:2px solid rgba(156,124,255,.8);outline-offset:3px}
