/* Evently certificate designer */
.cd-preview-host { margin-top: 10px; border-radius: 14px; overflow: hidden; border: 1px solid #3a334a; background: #0e0d16; }

/* The certificate "paper". Font sizes use cqw so text scales with the stage width. */
.cd-stage { position: relative; width: 100%; container-type: inline-size; background-size: 100% 100%; background-repeat: no-repeat; background-color: #fff; line-height: 1.2; text-align: left; }
.cd-static { overflow: hidden; }
.cd-el { position: absolute; box-sizing: border-box; margin: 0; overflow-wrap: break-word; }
.cd-text { white-space: pre-wrap; min-height: 1.2em; }
.cd-img img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }
.cd-qr svg { display: block; width: 100%; height: 100%; }
.cd-handle, .cd-guide { display: none; }

/* Dialog shell */
.cert-dialog { width: min(1320px, calc(100vw - 20px)); height: min(920px, calc(100vh - 20px)); max-width: none; max-height: none; padding: 0; border: 1px solid #524466; border-radius: 24px; background: #171521; color: #fff; overflow: hidden; box-shadow: 0 35px 120px #000a; }
.cert-dialog[open] { display: flex; flex-direction: column; }
.cert-dialog::backdrop { background: #080710d6; backdrop-filter: blur(9px); }
.cd-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid #3a334a; background: linear-gradient(145deg, #272136, #1b1827); }
.cd-title .kicker { color: #ff91d2; }
.cd-tpl-row { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.cd-tpl-row select, .cd-f input, .cd-f select, .cd-f textarea { min-height: 38px; padding: 6px 12px; border: 1px solid #484058; border-radius: 12px; background: #211e2f; color: #fff; font-size: 13px; font-weight: 700; max-width: 100%; }
.cd-tpl-row select { min-width: 180px; }
.cd-top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cd-top-actions .button { min-height: 38px; padding: 0 16px; }
.small-btn svg, .button svg { width: 15px; height: 15px; }
.cd-top-actions .small-btn { display: inline-flex; align-items: center; gap: 6px; }

.cd-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.cd-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 14px 18px; gap: 12px; background: radial-gradient(circle at 30% 0, #2a2040 0, transparent 55%), #12111b; }
.cd-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cd-toolbar .small-btn { display: inline-flex; align-items: center; gap: 6px; }
.cd-switch { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: #d7cdea; }
.cd-stage-wrap { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 6px; }
.cd-stage.cd-edit { width: min(100%, 980px); box-shadow: 0 18px 60px #000b, 0 0 0 1px #ffffff22; flex: none; touch-action: none; }
.cd-hint { margin: 0; color: #9b92b0; font-size: 11.5px; text-align: center; }

.cd-edit .cd-el { cursor: grab; touch-action: none; outline: 1px dashed transparent; outline-offset: 2px; }
.cd-edit .cd-el:hover { outline-color: #ff59b8aa; }
.cd-edit .cd-el:active { cursor: grabbing; }
.cd-edit .cd-el:focus-visible { outline: 2px solid #72e9ff; }
.cd-edit .cd-el.sel { outline: 2px solid #ff59b8; z-index: 5; }
.cd-edit .cd-el.sel .cd-handle { display: block; position: absolute; right: -9px; bottom: -9px; width: 16px; height: 16px; border-radius: 50%; background: #ff59b8; border: 2px solid #fff; cursor: nwse-resize; box-shadow: 0 2px 8px #0008; }
.cd-edit .cd-text.sel .cd-handle { bottom: 50%; margin-bottom: -8px; cursor: ew-resize; }
.cd-edit .cd-guide { position: absolute; left: 50%; top: 0; bottom: 0; width: 0; border-left: 1px dashed #66e6ff; pointer-events: none; z-index: 6; }

/* Side panel */
.cd-panel { min-height: 0; overflow: auto; padding: 14px 16px 24px; border-left: 1px solid #3a334a; background: #1a1825; display: flex; flex-direction: column; gap: 12px; }
.cd-group { padding: 12px; border: 1px solid #373147; border-radius: 16px; background: #211e2f; display: flex; flex-direction: column; gap: 10px; }
.cd-group h4 { margin: 0; font: 1000 12px 'Nunito', sans-serif; letter-spacing: .6px; text-transform: uppercase; color: #ff91d2; }
.cd-group h4 small { text-transform: none; letter-spacing: 0; color: #9b92b0; font-weight: 700; }
.cd-f { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 900; color: #cfc5e3; min-width: 0; }
.cd-f input, .cd-f select, .cd-f textarea { width: 100%; }
.cd-f textarea { min-height: 70px; resize: vertical; font-weight: 600; line-height: 1.35; }
.cd-f input:focus, .cd-f select:focus, .cd-f textarea:focus, .cd-tpl-row select:focus { outline: none; border-color: #ff70c3; box-shadow: 0 0 0 4px #ff59b81c; }
.cd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.cd-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cd-label { font-size: 11px; font-weight: 900; color: #cfc5e3; margin-bottom: -4px; }
.cd-note { margin: 0; font-size: 11.5px; color: #b7afc8; line-height: 1.4; }
.cd-empty { margin: 0; font-size: 12px; color: #9b92b0; }
.cd-wide { width: 100%; justify-content: center; min-height: 40px; }
.cd-check { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; font-weight: 700; color: #ddd4ed; }
.cd-check small { color: #9b92b0; font-weight: 600; }

.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-chip { padding: 5px 10px; border: 1px solid #484058; border-radius: 999px; background: #272336; color: #e8e0f4; font-size: 11px; font-weight: 900; }
.cd-chip:hover { border-color: #ff67bd; }
.cd-chip.on { background: #ff59b8; border-color: #ff59b8; color: #1a0f1a; }
.cd-chip[data-cd="token"] { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; color: #a8ffdf; }

.cd-tools { display: flex; align-items: center; gap: 6px; }
.cd-tb { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #484058; border-radius: 10px; background: #272336; color: #e8e0f4; padding: 0; }
.cd-tb svg { width: 16px; height: 16px; }
.cd-tb.on { background: #ff59b8; border-color: #ff59b8; color: #1a0f1a; }
.cd-sep { width: 1px; height: 22px; background: #484058; margin: 0 4px; }

.cd-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-sw { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px; border: 1px solid #484058; border-radius: 999px; background: #272336; color: #e8e0f4; font-size: 11px; font-weight: 800; cursor: pointer; }
.cd-sw::before { content: ''; width: 18px; height: 18px; border-radius: 50%; background: var(--c, conic-gradient(#ff59b8, #66e6ff, #c7ff70, #ff59b8)); border: 2px solid #ffffff55; }
.cd-sw.on { border-color: #ff59b8; box-shadow: 0 0 0 2px #ff59b855; }
.cd-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.cd-colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cd-color { display: flex; flex-direction: column; gap: 4px; font-size: 10px; font-weight: 900; color: #cfc5e3; }
.cd-color input { width: 100%; height: 34px; padding: 2px; border: 1px solid #484058; border-radius: 9px; background: #272336; cursor: pointer; }

.cd-layers { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow: auto; }
.cd-layer { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 8px; border: 1px solid transparent; border-radius: 10px; background: #272336; cursor: pointer; font-size: 12px; font-weight: 700; }
.cd-layer:hover { border-color: #484058; }
.cd-layer.on { border-color: #ff59b8; background: #35243f; }
.cd-ltype { display: grid; place-items: center; color: #a8ffdf; }
.cd-ltype svg { width: 14px; height: 14px; }
.cd-lname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-mini { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #cfc5e3; }
.cd-mini:hover { background: #3b3350; }
.cd-mini svg { width: 14px; height: 14px; }

@media (max-width: 900px) {
  .cert-dialog { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .cd-body { grid-template-columns: 1fr; grid-template-rows: auto auto; overflow: auto; }
  .cd-main { padding: 10px; }
  .cd-main { flex: none; }
  .cd-stage-wrap { overflow: visible; flex: none; }
  .cd-panel { border-left: 0; border-top: 1px solid #3a334a; overflow: visible; }
  .cd-switch { margin-left: 0; }
  .cd-top { padding: 10px 12px; }
}

/* Your global styles leave inputs content-box; keep the designer's controls inside their columns. */
.cert-dialog input, .cert-dialog select, .cert-dialog textarea { box-sizing: border-box; }
.cd-check input, .cd-switch input { width: 16px; height: 16px; min-height: 0; padding: 0; flex: none; accent-color: #ff59b8; }