.wm-nudge {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.wm-nudge.hidden {
  opacity: 0;
  visibility: hidden;
}
.wm-nudge-panel {
  pointer-events: auto;
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wm-nudge-kicker {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 650;
  color: var(--color-text-secondary, rgb(60, 60, 58));
}
.wm-nudge-title {
  font-family: var(--font-family);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.2;
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-nudge-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.wm-nudge-action {
  min-height: 92px;
  border: 1px solid rgba(20, 24, 31, 0.1);
  border-radius: 8px;
  background: var(--color-card, #fff);
  color: var(--color-text-primary, rgb(19, 19, 19));
  padding: 12px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.wm-nudge-action:hover {
  border-color: rgba(212, 168, 154, 0.35);
  background: rgba(212, 168, 154, 0.06);
  transform: translateY(-1px);
}
.wm-nudge-action svg {
  color: var(--color-text-secondary, #4a5768);
  flex: 0 0 auto;
}
.wm-nudge-action span {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
}
.wm-nudge-action small {
  font-family: var(--font-family);
  font-size: 12px;
  line-height: 1.25;
  color: var(--color-text-secondary, rgb(60, 60, 58));
}
.wm-nudge-text {
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 400;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  margin: 0;
  pointer-events: none;
  display: none;
}
.wm-nudge-link {
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  background: none;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  pointer-events: auto;
  transition: opacity 0.2s;
}
.wm-nudge-link:hover {
  opacity: 0.75;
  text-decoration: underline;
}
.wm-meaning-review {
  margin-top: 10px;
  border: 1px solid rgba(33, 150, 83, 0.24);
  border-radius: 8px;
  background: rgba(33, 150, 83, 0.05);
  padding: 12px;
  font-family: var(--font-family);
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-meaning-review--check {
  border-color: rgba(226, 150, 44, 0.32);
  background: rgba(226, 150, 44, 0.06);
}
.wm-meaning-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.wm-meaning-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2f6f4e;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  flex: 0 0 auto;
}
.wm-meaning-review--check .wm-meaning-icon {
  background: #b66a1e;
}
.wm-meaning-head strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}
.wm-meaning-head small {
  display: block;
  margin-top: 2px;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  font-size: 12px;
  line-height: 1.35;
}
.wm-meaning-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--color-text-secondary, #6d7a8a);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
}
.wm-meaning-close:hover {
  background: rgba(0, 0, 0, 0.06);
}
.wm-meaning-section {
  margin: 10px 0 0 34px;
}
.wm-meaning-section strong {
  font-size: 12px;
}
.wm-meaning-section ul {
  margin: 5px 0 0;
  padding-left: 18px;
}
.wm-meaning-section li {
  margin: 3px 0;
  font-size: 12.5px;
  line-height: 1.35;
}
/* ── Calm Skabeloner tokens (scoped) ── */
.bb-skrivebord .wm-form,
.bb-skrivebord .sidebar-tpl-swap {
  --calm-anchor: #3A2F26;
  --calm-body: #5C4D43;
  --calm-muted: #9A8E82;
  --calm-canvas: #FFFEFB;
  --calm-surface: #FBF8F2;
  --calm-sage: #6E8A7E;
  --calm-sage-dark: #4A7A68;
  --calm-warm-wash: #F6F1E8;
  --calm-hairline-soft: rgba(58,47,38,0.06);
  --calm-hairline-mid: rgba(58,47,38,0.10);
  --calm-hairline-strong: rgba(58,47,38,0.16);
  --calm-hairline-wrapper: rgba(228,220,212,0.72);
  --calm-sage-tint-08: rgba(110,138,126,0.08);
  --calm-sage-tint-10: rgba(110,138,126,0.10);
  --calm-sage-tint-12: rgba(110,138,126,0.12);
  --calm-sage-tint-16: rgba(110,138,126,0.16);
  --calm-sage-tint-25: rgba(110,138,126,0.25);
  --calm-radius-pill: 14px;
  --calm-radius-card: 12px;
  --calm-radius-chip: 10px;
  --calm-radius-icon-sm: 8px;
  --calm-radius-wrapper: 20px;
  --calm-t-fast: .15s ease;
}

.wm-form {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 24px;
  background: var(--calm-canvas, #FFFEFB);
  overflow-y: auto;
  overflow-x: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.wm-form.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.wm-form-inner {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wm-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: none;
  margin-bottom: 0;
}
.wm-form-header > span:first-child {
  flex: 1;
  min-width: 0;
}
.wm-form-header span {
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--calm-anchor, #3A2F26);
  letter-spacing: 0;
}
.wm-collapse-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--calm-radius-icon-sm, 8px);
  background: var(--calm-hairline-soft, rgba(58,47,38,0.06));
  color: var(--calm-muted, #9A8E82);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--calm-t-fast, .15s ease), transform 0.12s;
}
.wm-collapse-btn:hover {
  background: var(--calm-hairline-mid, rgba(58,47,38,0.10));
  transform: scale(1.06);
}
.wm-collapse-btn:active {
  transform: scale(0.94);
}
.wm-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.wm-field label {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  color: var(--calm-body, #5C4D43);
  text-transform: none;
  letter-spacing: 0.04em;
}
.wm-field input,
.wm-field textarea {
  font-family: var(--font-family);
  font-size: 16px;
  padding: 11px 14px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: var(--color-card, #fff);
  color: var(--color-text-primary, rgb(19, 19, 19));
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, height 0.1s ease;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  field-sizing: content;
}
.wm-field input:focus-visible,
.wm-field textarea:focus-visible {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: none;
}
.wm-field input::placeholder,
.wm-field textarea::placeholder {
  color: var(--color-text-secondary, rgb(60, 60, 58));
  opacity: 0.7;
}
.wm-textarea-wrap {
  position: relative;
}
.wm-textarea-wrap textarea {
  width: 100%;
  padding-right: 44px;
}
.wm-clear-btn {
  position: absolute;
  top: 6px;
  right: 48px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-tertiary, #94918b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, color 150ms ease, background 150ms ease;
  z-index: 2;
}
.wm-clear-btn.visible {
  opacity: 0.5;
  pointer-events: auto;
}
.wm-clear-btn.visible:hover {
  opacity: 1;
  color: var(--color-error, #ff3e1d);
  background: rgba(255, 62, 29, 0.08);
}
.wm-mic-btn {
  position: absolute;
  right: 8px;
  z-index: 1;
  min-width: 36px;
  min-height: 36px;
  padding: 6px;
  border-radius: var(--calm-radius-icon-sm, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--calm-muted, #9A8E82);
  cursor: pointer;
  transition: background var(--calm-t-fast, .15s ease), color var(--calm-t-fast, .15s ease);
}
.wm-mic-btn:hover {
  background: var(--calm-sage-tint-08, rgba(110,138,126,0.08));
  color: var(--calm-sage-dark, #4A7A68);
}
#wm-mic-task { top: 6px; }
#wm-mic-content { bottom: 8px; }
#wm-task {
  min-height: 38px;
  max-height: 200px;
}
#wm-content {
  min-height: 80px;
  max-height: 200px;
}
.wm-tpl-form-body .wm-field input,
.wm-tpl-form-body .wm-field textarea {
  font-size: 16px;
  padding: 8px 10px;
  background: var(--color-card, #fff);
}
.wm-tpl-form-body .wm-field textarea {
  min-height: 60px;
}
.wm-fields-card {
  background: var(--calm-surface, #FBF8F2);
  border: 0.5px solid var(--calm-hairline-soft, rgba(58,47,38,0.06));
  border-radius: var(--calm-radius-pill, 14px);
  box-shadow: 0 1px 3px rgba(58,47,38,0.04), 0 2px 8px rgba(58,47,38,0.03);
  overflow: hidden;
}
.wm-fields-card .wm-field {
  padding: 10px 14px;
  gap: 10px;
}
.wm-fields-card .wm-field + .wm-field {
  border-top: 0.5px solid var(--calm-hairline-soft, rgba(58,47,38,0.06));
}
.wm-fields-card .wm-field input,
.wm-fields-card .wm-field textarea {
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.025);
  padding: 10px 44px 10px 12px;
}
.wm-fields-card .wm-field input:focus-visible,
.wm-fields-card .wm-field textarea:focus-visible {
  background: rgba(0, 0, 0, 0.04);
  box-shadow: none;
}
[data-theme="dark"] .wm-fields-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 3px rgba(20, 18, 15, 0.2), 0 2px 8px rgba(20, 18, 15, 0.15);
}
[data-theme="dark"] .wm-fields-card .wm-field + .wm-field {
  border-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .wm-fields-card .wm-field input,
[data-theme="dark"] .wm-fields-card .wm-field textarea {
  background: rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .wm-fields-card .wm-field input:focus-visible,
[data-theme="dark"] .wm-fields-card .wm-field textarea:focus-visible {
  background: rgba(255, 255, 255, 0.07);
}
.wm-section-divider {
  display: none;
}
[data-theme="dark"] .wm-section-divider {
  color: rgba(232, 230, 225, 0.5);
}
.wm-tone-card {
  padding: 12px 16px 0;
  text-align: center;
  font-family: var(--font-family);
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.wm-tone-label {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--calm-body, #5C4D43);
  text-align: left;
  margin-bottom: 10px;
  text-transform: none;
  letter-spacing: 0.04em;
}
.wm-tone-current {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 650;
  color: var(--color-text-primary, rgb(19, 19, 19));
  margin-bottom: 1px;
  letter-spacing: -0.01em;
}
.wm-tone-desc {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  margin-bottom: 6px;
}
.wm-tone-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: #edeef0;
  border: none;
  cursor: pointer;
  margin: 0 0 8px;
  transition: all 0.3s ease;
}
.wm-tone-track:focus-visible {
  outline: none;
  outline-offset: 4px;
}
.wm-tone-track::before {
  display: none;
}
.wm-tone-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--color-text-primary);
  transition: width 0.15s ease;
  pointer-events: none;
}
.wm-tone-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--color-text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(74, 85, 104, 0.2);
  cursor: grab;
  transition: left 0.15s ease, box-shadow 0.15s ease;
  z-index: 3;
}
.wm-tone-thumb:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(74, 85, 104, 0.25);
}
.wm-tone-thumb:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.08);
}
.wm-tone-endpoints {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}
.wm-tone-endpoints span {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  opacity: 0.7;
}
.wm-submit {
  font-family: var(--font-family);
  padding: 11px 16px;
  border: none;
  border-radius: var(--calm-radius-card, 12px);
  background: var(--calm-sage, #6E8A7E);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(110,138,126,0.18);
  transition: box-shadow 0.2s ease, transform 0.2s ease, background 0.25s ease;
}
.wm-submit:hover {
  background: var(--calm-sage-dark, #4A7A68);
  box-shadow: 0 2px 8px rgba(110,138,126,0.22);
  transform: translateY(-1px);
}
.wm-submit:active {
  transform: translateY(0) scale(0.985);
  box-shadow: 0 1px 2px rgba(110,138,126,0.2);
  transition-duration: 0.1s;
}
.wm-submit:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.wm-submit-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
  transition: opacity 0.2s, background 0.2s, transform 0.2s;
}
.wm-submit:hover .wm-submit-icon {
  opacity: 1;
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.04);
}
.wm-submit-icon svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.8;
}
.wm-submit-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wm-btn-text {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1.2;
}
.wm-submit-desc {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.3;
}
.wm-submit.loading .wm-btn-text { display: none; }
.wm-submit.loading .wm-submit-desc { display: none; }
.wm-submit.loading .wm-btn-loader { display: inline-block; }
.wm-btn-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wm-spin 0.6s linear infinite;
}
@keyframes wm-spin { to { transform: rotate(360deg); } }
.wm-back-link {
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: center;
  transition: color 0.2s;
}
.wm-back-link:hover {
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.sidebar-wrapper {
  position: relative !important;
}
[data-theme="dark"] #ss.sidebar-wrapper,
[data-theme="dark"] .sidebar-wrapper {
  border-left-color: var(--color-border, rgba(255, 255, 255, 0.12)) !important;
}
.wm-tpl-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--color-bg, #FAFAF8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.wm-tpl-panel.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.wm-tpl-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.wm-tpl-view-hidden {
  display: none !important;
}
.wm-tpl-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: none;
  background: transparent;
  flex-shrink: 0;
}
.wm-tpl-header svg {
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-tpl-header span {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 650;
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-tpl-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
  flex-shrink: 0;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.wm-tpl-add:hover {
  background: rgba(0, 0, 0, 0.03);
}
.wm-tpl-add svg {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.wm-tpl-add span {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.wm-tpl-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.08) transparent;
}
.wm-tpl-empty {
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  text-align: center;
  padding: 32px 16px;
}
.wm-tpl-card {
  position: relative;
  padding: 14px 16px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  background: var(--color-card, #fff);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.wm-tpl-card:hover {
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}
.wm-tpl-card.active {
  border-color: rgba(0, 0, 0, 0.22);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
  background: var(--color-bg, #FAFAF8);
}
.wm-tpl-card-body {
  padding-right: 40px;
}
.wm-tpl-title {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 650;
  color: var(--color-text-primary, rgb(19, 19, 19));
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wm-tpl-preview {
  font-family: var(--font-family);
  font-size: 12.5px;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wm-tpl-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: stretch;
  gap: 0;
  opacity: 0;
  transition: opacity 0.15s;
  background: var(--color-card, #fff);
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.wm-tpl-card-actions .wm-tpl-share::after,
.wm-tpl-card-actions .wm-tpl-pin::after,
.wm-tpl-card-actions .wm-tpl-edit::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 5px;
  bottom: 5px;
  width: 1px;
  background: rgba(0, 0, 0, 0.08);
}
.wm-tpl-card:hover .wm-tpl-card-actions {
  opacity: 1;
}
.wm-tpl-share,
.wm-tpl-pin,
.wm-tpl-edit,
.wm-tpl-delete {
  position: relative;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary, #6d7a8a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.wm-tpl-share svg,
.wm-tpl-pin svg,
.wm-tpl-edit svg,
.wm-tpl-delete svg {
  display: block;
}
.wm-tpl-pin svg {
  transform: translateY(1px);
}
.wm-tpl-share:hover {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}
.wm-tpl-edit:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--color-text-primary);
}
.wm-tpl-delete:hover {
  background: rgba(226, 70, 104, 0.1);
  color: var(--color-primary);
}
.wm-tpl-form-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  background: var(--color-card, #fff);
  flex-shrink: 0;
}
.wm-tpl-back-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary, #6d7a8a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.wm-tpl-back-btn:hover {
  background: var(--color-bg, #FAFAF8);
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-tpl-form-header span {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 650;
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-tpl-form-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wm-tpl-save-btn {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 650;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #4f5e6f 0%, #3b4857 50%, #364252 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  transition: filter 0.2s, transform 0.1s;
  margin-top: 4px;
}
.wm-tpl-save-btn:hover { filter: brightness(1.08); }
.wm-tpl-save-btn:active { transform: scale(0.98); }
.wm-tpl-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.wm-tpl-save-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.wm-tpl-save-btn.loading .wm-tpl-save-text { display: none; }
.wm-tpl-save-btn.loading .wm-tpl-save-loader { display: inline-block; }
.wm-tpl-save-loader {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wm-spin 0.6s linear infinite;
}
.wm-tpl-tone-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.wm-tpl-tone-pill {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  background: var(--color-card, #fff);
  color: var(--color-text-secondary, rgb(60, 60, 58));
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.wm-tpl-tone-pill:hover {
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-tpl-tone-pill.active {
  background: #384551;
  border-color: var(--color-text-primary);
  color: #fff;
}
[data-theme="dark"] .wm-tpl-tone-pill {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(232, 230, 225, 0.7);
}
[data-theme="dark"] .wm-tpl-tone-pill:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(232, 230, 225, 0.9);
}
[data-theme="dark"] .wm-tpl-tone-pill.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.wm-field-optional {
  font-weight: 400;
  font-size: 11px;
  color: var(--color-text-secondary, #a1a4b5);
  opacity: 0.7;
}
.wm-tpl-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.wm-tpl-title-row .wm-tpl-title {
  margin-bottom: 0;
}
.wm-tpl-tone-badge {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text-secondary, rgb(60, 60, 58));
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .wm-tpl-tone-badge {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(232, 230, 225, 0.6);
}
body.wm-form-open .top-controls.skv2-top-controls {
  display: none !important;
}
body.wm-form-open .counter-nav-div {
  display: none !important;
}
.grammar-page.editor-empty .top-controls.skv2-top-controls {
  opacity: 0.55 !important;
  pointer-events: none !important;
  transition: opacity 0.4s ease !important;
}
.grammar-page.editor-empty .top-controls.skv2-top-controls:has(.lang-pill-open) {
  opacity: 1 !important;
  pointer-events: auto !important;
}
.grammar-page.editor-empty .top-controls .left-controls {
  opacity: 1 !important;
  pointer-events: auto !important;
}
.grammar-page.editor-empty .counter-nav-div {
  opacity: 0.45 !important;
  pointer-events: none !important;
  transition: opacity 0.4s ease !important;
}
.grammar-page.editor-empty .sidebar-wrapper {
  transition: opacity 0.4s ease !important;
}
.grammar-page.editor-empty .correction-sidebar {
  pointer-events: none !important;
  transition: opacity 0.4s ease !important;
}
.grammar-page.editor-empty .correction-sidebar > *:not(.sidebar-controls) {
  opacity: 0.4 !important;
}
.grammar-page.editor-empty .sidebar-controls {
  opacity: 1 !important;
}
.grammar-page.editor-empty .sidebar-controls > *:not(.dk-translation-box) {
  opacity: 0.4 !important;
  pointer-events: none !important;
}
.grammar-page.editor-empty .sidebar-controls .dk-translation-box {
  opacity: 1 !important;
  pointer-events: auto !important;
}
.grammar-page.editor-empty .sidebar-dropdown-items {
  opacity: 0.4 !important;
  pointer-events: none !important;
  transition: opacity 0.4s ease !important;
}
.ql-editor.ql-blank::before {
  display: none !important;
}
.grammar-page .top-controls,
.grammar-page .counter-nav-div,
.grammar-page .sidebar-wrapper {
  transition: opacity 0.4s ease;
}
@media (max-width: 768px) {
  body.wm-form-open {
    overflow: auto !important;
    position: fixed !important;
    width: 100% !important;
  }
  .wm-nudge { padding: 12px 16px 16px 16px; }
  .wm-form {
    position: fixed;
    inset: 0 0 calc(56px + env(safe-area-inset-bottom, 0px)) 0;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 16px 12px;
    padding-bottom: 80px;
    overflow-y: scroll;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .wm-tpl-panel { display: none; }
  .wm-form-inner { gap: 14px; width: 100%; }
  .wm-field { gap: 6px; }
  .wm-field textarea,
  .wm-field input {
    padding: 10px 52px 10px 12px;
    font-size: 16px;
    border-radius: 10px;
  }
  #wm-task { min-height: 36px; }
  #wm-content { min-height: 48px; }

  /* ── Tone: hide slider, show chips exclusively ── */
  .wm-tone-card { padding: 4px 0 0; }
  .wm-tone-track,
  .wm-tone-endpoints,
  .wm-tone-current,
  .wm-tone-desc { display: none; }

  /* ── Mic buttons: larger, colored, labeled ── */
  .wm-mic-btn {
    min-width: 44px;
    min-height: 44px;
    width: auto;
    height: auto;
    padding: 6px 10px;
    border-radius: var(--calm-radius-card, 12px);
    flex-direction: column;
    gap: 1px;
    background: var(--calm-sage-tint-08, rgba(110,138,126,0.08));
    border: 1.5px solid var(--calm-sage-tint-25, rgba(110,138,126,0.25));
    color: var(--calm-sage-dark, #4A7A68);
  }
  .wm-mic-btn svg {
    width: 18px;
    height: 18px;
  }
  .wm-mic-btn .wm-mic-label {
    display: block;
  }

  /* ── Recording state ── */
  .wm-mic-btn.ss-mic--recording {
    background: rgba(194, 75, 96, 0.12);
    border-color: rgba(194, 75, 96, 0.35);
    color: #c24b60;
    animation: wm-mic-pulse 1.5s ease-in-out infinite;
  }
  .wm-mic-btn.ss-mic--recording svg {
    color: #c24b60;
  }

  /* ── Submit: sticky at viewport bottom ── */
  .wm-submit {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    z-index: 30;
    border-radius: 16px;
    padding: 15px 24px;
    font-size: 16px;
    min-height: 52px;
    box-shadow:
      0 -4px 12px rgba(0, 0, 0, 0.08),
      0 2px 6px rgba(110,138,126,0.14);
  }

  .wm-language-row { margin-top: -4px; }

  /* ── Template sheet cards: larger tap targets ── */
  .wm-sheet-card {
    min-height: 56px;
    display: flex;
    align-items: center;
    padding: 14px;
  }

  /* ── All buttons: 48px min touch target ── */
  .wm-nudge-action { min-height: 48px; }
  .wm-collapse-btn { min-width: 44px; min-height: 44px; }
  .wm-sheet-close { min-width: 44px; min-height: 44px; width: 44px; height: 44px; }
  .wm-sheet-tab { min-height: 44px; }
  .wm-tpl-add { min-height: 48px; }

  /* ── Chip bar: ensure adequate sizing ── */
  .wm-chip {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 14px;
  }
}

/* ── Mobile tone chips ── */
.wm-tone-chips {
  display: none;
}
@media (max-width: 768px) {
  .wm-tone-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 4px;
  }
  .wm-tone-chips::-webkit-scrollbar { display: none; }
  .wm-tone-chip {
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    background: var(--color-card, #fff);
    color: var(--color-text-primary, rgb(19, 19, 19));
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 40px;
    transition: all 0.15s;
  }
  .wm-tone-chip:active {
    transform: scale(0.96);
  }
  .wm-tone-chip.active {
    background: #4A7A68;
    color: #fff;
    border-color: #4A7A68;
  }
  [data-theme="dark"] .wm-tone-chip {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.10);
    color: var(--color-text-primary, #e8e6e1);
  }
  [data-theme="dark"] .wm-tone-chip.active {
    background: #4A7A68;
    color: #fff;
    border-color: #4A7A68;
  }
}

/* ── Mic pulse animation ── */
@keyframes wm-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(194, 75, 96, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(194, 75, 96, 0); }
}

/* ── Mobile mic label (hidden on desktop) ── */
.wm-mic-label {
  display: none;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  margin-top: 1px;
}

/* ── Recording indicator badge ── */
.wm-recording-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(194, 75, 96, 0.08);
  border: 1px solid rgba(194, 75, 96, 0.2);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  color: #c24b60;
}
.wm-recording-indicator.visible {
  display: flex;
}
.wm-recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c24b60;
  animation: wm-rec-blink 1s ease-in-out infinite;
}
@keyframes wm-rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.wm-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.wm-confirm-overlay.visible {
  opacity: 1;
}
.wm-confirm-box {
  background: var(--color-card, #fff);
  border-radius: 12px;
  padding: 24px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  transform: scale(0.95);
  transition: transform 0.15s ease;
  text-align: center;
}
.wm-confirm-overlay.visible .wm-confirm-box {
  transform: scale(1);
}
.wm-confirm-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(226, 70, 104, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}
.wm-confirm-title {
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 650;
  color: var(--color-text-primary, rgb(19, 19, 19));
  margin-bottom: 6px;
}
.wm-confirm-desc {
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  margin-bottom: 20px;
  line-height: 1.5;
}
.wm-confirm-actions {
  display: flex;
  gap: 10px;
}
.wm-confirm-cancel,
.wm-confirm-delete {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  min-height: 44px;
  transition: background 0.15s, opacity 0.15s;
}
.wm-confirm-cancel {
  background: var(--color-bg, #FAFAF8);
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-confirm-cancel:hover {
  background: rgba(0, 0, 0, 0.08);
}
.wm-confirm-delete {
  background: var(--color-primary);
  color: #fff;
}
.wm-confirm-delete:hover {
  opacity: 0.9;
}
[data-theme="dark"] .wm-confirm-box {
  background: var(--color-card, #2b2a27);
  box-shadow: 0 8px 32px rgba(20, 18, 15, 0.5);
}
[data-theme="dark"] .wm-confirm-cancel {
  background: var(--color-bg, #1c1b18);
}
[data-theme="dark"] .wm-confirm-cancel:hover {
  background: var(--color-border, rgba(255, 255, 255, 0.12));
}
[data-theme="dark"] .wm-form {
  background:
    radial-gradient(ellipse at 74% 18%, rgba(212, 168, 154, 0.03) 0%, transparent 48%),
    radial-gradient(ellipse at 22% 86%, rgba(168, 197, 184, 0.02) 0%, transparent 48%),
    var(--color-card, #2b2a27);
}
[data-theme="dark"] .wm-field input,
[data-theme="dark"] .wm-field textarea {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--color-text-primary, #e8e6e1);
}
[data-theme="dark"] .wm-field input:focus-visible,
[data-theme="dark"] .wm-field textarea:focus-visible {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}
[data-theme="dark"] .wm-collapse-btn {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(232,230,225,0.6);
}
[data-theme="dark"] .wm-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .wm-form-header {
  border-bottom: none;
}
[data-theme="dark"] .wm-field label {
  color: var(--color-text-secondary, #a3a19b);
}
[data-theme="dark"] .wm-submit {
  background: rgba(110,138,126,0.25);
  color: #fff;
  border: none;
  box-shadow: 0 1px 4px rgba(20, 18, 15, 0.3);
}
[data-theme="dark"] .wm-submit:hover {
  background: rgba(110,138,126,0.35);
  box-shadow: 0 2px 8px rgba(20, 18, 15, 0.35);
}
[data-theme="dark"] .wm-submit-icon {
  background: rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .wm-submit-icon svg {
  stroke: #fff;
}
[data-theme="dark"] .wm-btn-text {
  color: #fff;
}
[data-theme="dark"] .wm-submit-desc {
  color: rgba(255, 255, 255, 0.55);
}
[data-theme="dark"] .wm-btn-loader {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
}
[data-theme="dark"] .wm-tone-card {
  background: transparent;
  border: none;
  box-shadow: none;
}
[data-theme="dark"] .wm-tone-current {
  color: #fff;
}
[data-theme="dark"] .wm-tone-desc {
  color: rgba(232, 230, 225, 0.55);
}
[data-theme="dark"] .wm-tone-endpoints span {
  color: rgba(232, 230, 225, 0.45);
}
[data-theme="dark"] .wm-tone-track {
  background: rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .wm-tone-progress {
  background: linear-gradient(90deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.4) 100%);
}
[data-theme="dark"] .wm-tpl-panel {
  background: var(--color-bg, #1c1b18);
}
[data-theme="dark"] .wm-tpl-header {
  border-bottom: none;
  background: transparent;
}
[data-theme="dark"] .wm-tpl-header svg {
  color: var(--color-text-primary, #e8e6e1);
}
[data-theme="dark"] .wm-tpl-add {
  border-bottom-color: rgba(255, 255, 255, 0.06);
  background: transparent;
}
[data-theme="dark"] .wm-tpl-add svg {
  color: rgba(232, 230, 225, 0.6);
}
[data-theme="dark"] .wm-tpl-add span {
  color: rgba(232, 230, 225, 0.6);
}
[data-theme="dark"] .wm-tpl-add:hover {
  background: var(--color-bg, #1c1b18);
}
[data-theme="dark"] .wm-tpl-card {
  border-color: var(--color-border, rgba(255, 255, 255, 0.12));
}
[data-theme="dark"] .wm-tpl-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 8px rgba(20, 18, 15, 0.2);
}
[data-theme="dark"] .wm-tpl-card.active {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .wm-tpl-card-actions {
  background: var(--color-card, #2b2a27);
  box-shadow: 0 1px 4px rgba(20, 18, 15, 0.25);
}
[data-theme="dark"] .wm-tpl-card-actions .wm-tpl-share::after,
[data-theme="dark"] .wm-tpl-card-actions .wm-tpl-pin::after,
[data-theme="dark"] .wm-tpl-card-actions .wm-tpl-edit::after {
  background: rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .wm-tpl-share,
[data-theme="dark"] .wm-tpl-pin,
[data-theme="dark"] .wm-tpl-edit,
[data-theme="dark"] .wm-tpl-delete {
  background: transparent;
  color: rgba(232, 230, 225, 0.6);
}
[data-theme="dark"] .wm-tpl-form-header {
  border-color: var(--color-border, rgba(255, 255, 255, 0.12));
}
[data-theme="dark"] .wm-tpl-back-btn:hover {
  background: var(--color-bg, #1c1b18);
}
[data-theme="dark"] .wm-tone-track::before {
  display: none;
}
[data-theme="dark"] .wm-tone-thumb {
  background: var(--color-card, #2b2a27);
  border-color: #a3a19b;
  box-shadow: 0 1px 4px rgba(20, 18, 15, 0.3), 0 2px 8px rgba(163, 161, 155, 0.25);
}
.wm-nudge-link:focus-visible,
.wm-collapse-btn:focus-visible,
.wm-submit:focus-visible,
.wm-back-link:focus-visible,
.wm-tpl-add:focus-visible,
.wm-tpl-card:focus-visible,
.wm-tpl-edit:focus-visible,
.wm-tpl-delete:focus-visible,
.wm-tpl-back-btn:focus-visible,
.wm-tpl-save-btn:focus-visible {
  outline: none;
  outline-offset: 2px;
}
.wm-field input:focus-visible,
.wm-field textarea:focus-visible {
  outline: none;
}
.wm-field select:focus-visible {
  outline: none;
}
[data-theme=dark] .wm-nudge-text,
[data-theme=dark] .wm-tone-desc,
[data-theme=dark] .wm-tone-endpoint,
[data-theme=dark] .wm-back-link,
[data-theme=dark] .wm-tpl-empty,
[data-theme=dark] .wm-tpl-preview {
  color: var(--color-text-secondary, #a3aab5);
}
.wm-submit,
.wm-tpl-save-btn {
  min-height: 44px;
}
.wm-tpl-add {
  min-height: 44px;
}
.wm-collapse-btn,
.wm-tpl-edit,
.wm-tpl-delete,
.wm-tpl-back-btn {
  min-width: 36px;
  min-height: 36px;
}
.wm-language-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2px;
  position: relative;
}
.wm-language-row--compact,
.wm-lang-compact-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.wm-pill-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.wm-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  min-height: 44px;
  border: none;
  border-left: 4px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 400;
  color: #5C4D43;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  line-height: 1.2;
}
.wm-pill:hover {
  background: rgba(212, 168, 154, 0.1);
}
.wm-pill.selected {
  background: rgba(212, 168, 154, 0.2);
  border-left-color: #D4A89A;
  font-weight: 500;
}
.wm-pill:focus-visible {
  outline: none;
  background: rgba(212, 168, 154, 0.16);
  border-left-color: #D4A89A;
}
.wm-pill-more {
  font-family: var(--font-family);
  font-size: 15px;
  letter-spacing: 0;
  padding: 10px 14px;
}
.wm-pill-overflow-wrap {
  position: relative;
  display: inline-flex;
}
.wm-pill-overflow {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 200;
  background: rgba(255, 254, 251, 0.97);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid rgba(228, 220, 212, 0.6);
  border-radius: 14px;
  box-shadow:
    0 1px 2px rgba(92, 77, 67, 0.06),
    0 4px 16px rgba(92, 77, 67, 0.08),
    0 12px 40px rgba(92, 77, 67, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  padding: 6px;
  min-width: 160px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
  animation: wmPillFadeIn 0.18s ease;
}
@keyframes wmPillFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.wm-pill-overflow.hidden {
  display: none;
}
.wm-pill-overflow::-webkit-scrollbar {
  width: 4px;
}
.wm-pill-overflow::-webkit-scrollbar-track {
  background: transparent;
}
.wm-pill-overflow::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
}
.wm-pill-overflow-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 400;
  color: #5C4D43;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
  text-align: left;
}
.wm-pill-overflow-option:hover {
  background: rgba(212, 168, 154, 0.12);
}
.wm-pill-overflow-option.selected {
  background: rgba(212, 168, 154, 0.2);
  font-weight: 500;
  color: var(--skv2-rose-dark, #9B6050);
}
.wm-pill-overflow-option.selected::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 10px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239B6050' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}
.wm-pill-overflow-option:focus-visible {
  outline: none;
  background: rgba(212, 168, 154, 0.16);
  color: var(--skv2-rose-dark, #9B6050);
}
@media (max-width: 639px) {
  .wm-pill-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .wm-pill-bar::-webkit-scrollbar {
    display: none;
  }
  .wm-pill {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 14px;
  }
}
[data-theme="dark"] .wm-pill,
.dark-mode .wm-pill {
  color: rgba(232, 230, 225, 0.7) !important;
}
[data-theme="dark"] .wm-pill:hover,
.dark-mode .wm-pill:hover {
  background: rgba(212, 168, 154, 0.12) !important;
  color: #E8DDD4 !important;
}
[data-theme="dark"] .wm-pill.selected,
.dark-mode .wm-pill.selected {
  background: rgba(212, 168, 154, 0.2) !important;
  border-left-color: #D4A89A !important;
  color: #E8DDD4 !important;
}
[data-theme="dark"] .wm-pill:focus-visible,
.dark-mode .wm-pill:focus-visible {
  outline: none !important;
  background: rgba(212, 168, 154, 0.16) !important;
  border-left-color: #D4A89A !important;
  color: #E8DDD4 !important;
}
[data-theme="dark"] .wm-pill-overflow,
.dark-mode .wm-pill-overflow {
  background: rgb(38, 33, 29) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
[data-theme="dark"] .wm-pill-overflow-option,
.dark-mode .wm-pill-overflow-option {
  color: #E8DDD4 !important;
}
[data-theme="dark"] .wm-pill-overflow-option:hover,
.dark-mode .wm-pill-overflow-option:hover {
  background: rgba(212, 168, 154, 0.10) !important;
}
[data-theme="dark"] .wm-pill-overflow-option:focus-visible,
.dark-mode .wm-pill-overflow-option:focus-visible {
  outline: none !important;
  background: rgba(212, 168, 154, 0.12) !important;
  color: #D4A89A !important;
}
[data-theme="dark"] .wm-pill-overflow-option.selected,
.dark-mode .wm-pill-overflow-option.selected {
  background: rgba(212, 168, 154, 0.12) !important;
  color: #D4A89A !important;
}
[data-theme="dark"] .wm-pill-overflow-option.selected::after,
.dark-mode .wm-pill-overflow-option.selected::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23D4A89A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") !important;
}

/* ── Compact language dropdown ─────────────────────────────── */
.wm-lang-compact-label {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary, #6b7280);
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 8px;
}
.wm-lang-compact-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.wm-lang-compact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 6px 12px;
  border-radius: 18px;
  border: 1px solid rgba(228, 220, 212, 0.6);
  background: rgba(255, 254, 251, 0.85);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  font: 500 13px/20px var(--font-family);
  color: var(--color-text-secondary, #5C4D43);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.wm-lang-compact-btn:hover {
  background: rgba(244, 232, 226, 0.55);
  border-color: rgba(228, 220, 212, 0.85);
  color: #5C4D43;
}
.wm-lang-compact-wrap.wm-lang-open .wm-lang-compact-btn {
  background: rgba(244, 232, 226, 0.7);
  border-color: rgba(212, 168, 154, 0.45);
  color: #5C4D43;
}
.wm-lang-compact-btn .wm-lang-globe {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.wm-lang-compact-btn .wm-lang-chevron {
  width: 8px;
  height: 5px;
  opacity: 0.6;
  transition: transform 0.2s;
}
.wm-lang-compact-wrap.wm-lang-open .wm-lang-chevron {
  transform: rotate(180deg);
}
.wm-lang-compact-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 9999;
  min-width: 152px;
  max-height: 340px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  background: rgba(255, 254, 251, 0.97);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-radius: 14px;
  border: 1px solid rgba(228, 220, 212, 0.6);
  box-shadow:
    0 1px 2px rgba(92, 77, 67, 0.06),
    0 4px 16px rgba(92, 77, 67, 0.08),
    0 12px 40px rgba(92, 77, 67, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  padding: 6px;
  animation: wmLangFadeUp 0.18s ease;
}
.wm-lang-compact-menu .wm-lang-more-section li {
  list-style: none;
}
@keyframes wmLangFadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.wm-lang-compact-menu.hidden {
  display: none;
}
.wm-lang-compact-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: #5C4D43;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.wm-lang-compact-option:hover {
  background: rgba(244, 232, 226, 0.55);
}
.wm-lang-compact-option.selected {
  background-color: rgba(110, 138, 126, 0.10);
  color: #3A2F26;
  font-weight: 600;
}
.wm-lang-compact-option.selected::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 10px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E8A7E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}
.wm-lang-divider {
  height: 1px;
  margin: 4px 8px;
  background: rgba(228, 220, 212, 0.4);
}
.wm-lang-more-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  color: #5C4D43;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.wm-lang-more-toggle:hover {
  background: rgba(244, 232, 226, 0.35);
  color: #3A2F26;
}
.wm-lang-compact-option:focus-visible,
.wm-lang-more-toggle:focus-visible {
  outline: 2px solid rgba(110, 138, 126, 0.50);
  outline-offset: -2px;
}
.wm-share-body .wm-field input[aria-invalid="true"] {
  border-color: var(--skv2-rose-dark, #9B6050);
  box-shadow: 0 0 0 3px rgba(155, 96, 80, 0.14);
}
.wm-lang-more-toggle .wm-lang-more-chevron {
  width: 8px;
  height: 5px;
  opacity: 0.6;
  transition: transform 0.2s ease;
}
.wm-lang-more-toggle.wm-lang-more-active .wm-lang-more-chevron {
  transform: rotate(180deg);
}
.wm-lang-more-section {
  display: none;
}
.wm-lang-more-section.wm-lang-more-open {
  display: block;
  animation: wmLangExpand 0.2s ease;
}
@keyframes wmLangExpand {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 400px; }
}
[data-theme="dark"] .wm-lang-compact-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  color: rgb(200, 190, 178);
}
[data-theme="dark"] .wm-lang-compact-btn:hover {
  background: rgba(212, 168, 154, 0.12);
  border-color: rgba(212, 168, 154, 0.25);
  color: #E8DDD4;
}
[data-theme="dark"] .wm-lang-compact-wrap.wm-lang-open .wm-lang-compact-btn {
  background: rgba(212, 168, 154, 0.15);
  border-color: rgba(212, 168, 154, 0.3);
  color: #E8DDD4;
}
[data-theme="dark"] .wm-lang-compact-menu {
  background: rgb(38, 33, 29) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
[data-theme="dark"] .wm-lang-compact-option {
  color: #E8DDD4;
}
[data-theme="dark"] .wm-lang-compact-option:hover {
  background: rgba(212, 168, 154, 0.10);
}
[data-theme="dark"] .wm-lang-compact-option.selected {
  background: rgba(110, 138, 126, 0.12);
  color: #E8DDD4;
  font-weight: 600;
}
[data-theme="dark"] .wm-lang-compact-option.selected::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2390B8A8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
[data-theme="dark"] .wm-lang-compact-label {
  color: rgba(232, 221, 212, 0.6);
}
[data-theme="dark"] .wm-lang-divider {
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .wm-lang-more-toggle {
  color: #C8BEB2;
}
[data-theme="dark"] .wm-lang-more-toggle:hover {
  background: rgba(110, 138, 126, 0.10);
  color: #E8DDD4;
}
[data-theme="dark"] .wm-lang-compact-option:focus-visible,
[data-theme="dark"] .wm-lang-more-toggle:focus-visible {
  outline-color: rgba(110, 138, 126, 0.50);
}

.wm-textarea-wrap textarea:focus-visible,
.wm-field input:focus-visible,
.wm-field textarea:focus-visible {
  outline: none !important;
}
.wm-wizard {
  margin-bottom: 4px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 12px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  transition: border-color 0.3s, background 0.3s;
}
.wm-wizard-prompt label {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 650;
  color: var(--color-text-primary, rgb(19, 19, 19));
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.wm-wizard-prompt label::before {
  content: '✨';
  font-size: 14px;
}
.wm-wizard-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.wm-wizard-input-row input {
  flex: 1;
  font-family: var(--font-family);
  font-size: 13px;
  padding: 10px 12px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: var(--color-card, #fff);
  color: var(--color-text-primary, rgb(19, 19, 19));
  outline: none;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.wm-wizard-input-row input:focus-visible {
  border-color: rgba(0, 0, 0, 0.22);
  box-shadow: none;
}
.wm-wizard-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f5e6f 0%, #3b4857 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s, transform 0.1s, box-shadow 0.2s;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.wm-wizard-btn:hover {
  filter: brightness(1.12);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}
.wm-wizard-btn:active { transform: scale(0.95); }
.wm-wizard-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.wm-wizard-btn svg { transition: opacity 0.15s; }
.wm-wizard-btn.loading svg { opacity: 0; }
.wm-wizard-btn.loading .wm-wizard-btn-loader { display: block; }
.wm-wizard-btn .wm-wizard-btn-check {
  display: none;
  position: absolute;
  width: 18px;
  height: 18px;
}
.wm-wizard-btn.success svg.wm-wizard-star { opacity: 0; }
.wm-wizard-btn.success .wm-wizard-btn-check {
  display: block;
  animation: wm-pop 0.35s ease;
}
.wm-wizard-btn.success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 2px 8px rgba(34,197,94,0.3);
}
@keyframes wm-pop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}
.wm-wizard-btn-loader {
  display: none;
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wm-spin 0.6s linear infinite;
}
.wm-wizard-hint {
  font-family: var(--font-family);
  font-size: 11px;
  color: var(--color-text-secondary, #a3a19b);
  margin-top: 6px;
  text-align: center;
  opacity: 0.7;
}
.wm-wizard-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 8px;
}
.wm-wizard-divider::before,
.wm-wizard-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
}
.wm-wizard-divider span {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary, #a3a19b);
  white-space: nowrap;
}
.wm-wizard-done {
  border-color: rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.03);
}
.wm-wizard-done .wm-wizard-prompt {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.4s;
}
@keyframes wm-field-flash {
  0% { background: rgba(0, 0, 0, 0.05); }
  100% { background: transparent; }
}
.wm-field-flash input,
.wm-field-flash textarea {
  animation: wm-field-flash 1.2s ease;
}
.wm-tpl-gallery-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--color-card, #fff);
  border: none;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  flex-shrink: 0;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.wm-tpl-gallery-btn:hover { background: var(--color-bg, #FAFAF8); }
.wm-tpl-gallery-btn svg {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.wm-tpl-gallery-btn span {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.wm-gallery-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.08) transparent;
}
.wm-gallery-cat {
  margin-bottom: 16px;
}
.wm-gallery-cat-title {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 650;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 4px 6px;
}
.wm-gallery-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  background: var(--color-card, #fff);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wm-gallery-card:hover {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.wm-gallery-card .wm-tpl-card-body {
  padding-right: 0;
  flex: 1;
  min-width: 0;
}
.wm-gallery-add-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  background: var(--color-bg, #FAFAF8);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-left: 8px;
}
.wm-gallery-add-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--color-text-primary);
  color: var(--color-text-primary);
}
.wm-gallery-add-btn:disabled {
  cursor: default;
  border-color: var(--color-success);
  background: rgba(40, 167, 69, 0.08);
}
.wm-tpl-drag-handle {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--color-text-secondary, #a1a4b5);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.wm-tpl-card:hover .wm-tpl-drag-handle {
  opacity: 0.6;
}
.wm-tpl-drag-handle:hover {
  opacity: 1 !important;
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-tpl-card {
  padding-left: 22px;
}
.wm-tpl-card.wm-dragging {
  opacity: 0.4;
}
.wm-tpl-card.wm-drag-over {
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}
.wm-tpl-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 4px 0;
}
.wm-tpl-pinned {
  border-color: rgba(240, 180, 41, 0.3);
  background: rgba(240, 180, 41, 0.03);
}
.wm-tpl-pin:hover {
  background: rgba(240, 180, 41, 0.12);
  color: var(--color-warning);
}
.wm-tpl-pin.active {
  color: var(--color-warning);
}
.wm-mobile-chips {
  display: none;
}
@media (max-width: 768px) {
  .wm-mobile-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 6px;
    margin-bottom: 0;
  }
  .wm-mobile-chips::-webkit-scrollbar { display: none; }
  .wm-chip {
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    background: var(--color-card, #fff);
    color: var(--color-text-primary, rgb(19, 19, 19));
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
    min-height: 38px;
  }
  .wm-chip:active {
    transform: scale(0.96);
    background: rgba(0, 0, 0, 0.04);
  }
  .wm-chip-all {
    background: rgba(0, 0, 0, 0.04);
    border-color: transparent;
    color: var(--color-text-secondary, rgb(60, 60, 58));
  }
}
.wm-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: flex-end;
  transition: background 0.3s ease;
}
.wm-sheet-overlay.visible {
  background: rgba(0, 0, 0, 0.45);
}
.wm-sheet {
  width: 100%;
  max-height: 80vh;
  background: var(--color-card, #fff);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.wm-sheet-overlay.visible .wm-sheet {
  transform: translateY(0);
}
.wm-sheet-drag {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
}
.wm-sheet-drag-pill {
  width: 36px;
  height: 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
}
.wm-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 10px;
}
.wm-sheet-header span {
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 650;
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-sheet-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text-secondary, #6d7a8a);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wm-sheet-tabs {
  display: flex;
  margin: 0 16px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  gap: 2px;
}
.wm-sheet-tab {
  flex: 1;
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary, #8a8d98);
  cursor: pointer;
  transition: all 0.2s;
}
.wm-sheet-tab.active {
  background: #fff;
  color: var(--color-text-primary, rgb(19, 19, 19));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.wm-sheet-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}
.wm-sheet-card {
  padding: 12px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--color-card, #fff);
  transition: background 0.15s;
}
.wm-sheet-card:active {
  background: rgba(0, 0, 0, 0.03);
}
.wm-sheet-add-row {
  padding: 8px 16px 16px;
  flex-shrink: 0;
}
.wm-sheet-add-row .wm-tpl-add {
  border-radius: 10px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  justify-content: center;
}
.wm-suggest-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 9999;
  background: var(--color-card, #fff);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  width: calc(100% - 32px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
}
.wm-suggest-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.wm-suggest-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.wm-suggest-content svg {
  flex-shrink: 0;
  color: var(--color-text-primary);
}
.wm-suggest-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.wm-suggest-text strong {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 650;
  color: var(--color-text-primary, rgb(19, 19, 19));
}
.wm-suggest-text span {
  font-family: var(--font-family);
  font-size: 11px;
  color: var(--color-text-secondary, rgb(60, 60, 58));
}
.wm-suggest-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.wm-suggest-yes {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 650;
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #4f5e6f 0%, #3b4857 100%);
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s;
}
.wm-suggest-yes:hover { filter: brightness(1.1); }
.wm-suggest-no {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-secondary, rgb(60, 60, 58));
  cursor: pointer;
}
.wm-suggest-no:hover {
  background: rgba(0, 0, 0, 0.04);
}
@media (max-width: 768px) {
  .wm-suggest-toast {
    bottom: 80px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 16px;
  }
  .wm-suggest-actions {
    justify-content: flex-end;
  }
}
[data-theme="dark"] .wm-nudge-kicker {
  color: rgba(232, 221, 212, 0.62);
}
[data-theme="dark"] .wm-nudge-title {
  color: #E8DDD4;
}
[data-theme="dark"] .wm-nudge-action {
  background: #2b2a27;
  border-color: rgba(255, 255, 255, 0.08);
  color: #E8DDD4;
}
[data-theme="dark"] .wm-nudge-action:hover {
  border-color: rgba(212, 168, 154, 0.25);
  background: rgba(212, 168, 154, 0.08);
}
[data-theme="dark"] .wm-nudge-action svg {
  color: rgba(232, 221, 212, 0.62);
}
[data-theme="dark"] .wm-nudge-action small {
  color: rgba(232, 221, 212, 0.62);
}
[data-theme="dark"] .wm-wizard {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .wm-wizard-prompt label {
  color: var(--color-text-primary, #e8e6e1);
}
[data-theme="dark"] .wm-wizard-input-row input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--color-text-primary, #e8e6e1);
}
[data-theme="dark"] .wm-wizard-input-row input:focus-visible {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: none;
}
[data-theme="dark"] .wm-wizard-divider::before,
[data-theme="dark"] .wm-wizard-divider::after {
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .wm-wizard-divider span {
  color: rgba(232, 230, 225, 0.5);
}
[data-theme="dark"] .wm-wizard-done {
  border-color: rgba(34,197,94,0.25);
  background: rgba(34,197,94,0.05);
}
[data-theme="dark"] .wm-tpl-gallery-btn {
  border-color: var(--color-border, rgba(255, 255, 255, 0.12));
}
[data-theme="dark"] .wm-tpl-gallery-btn:hover {
  background: var(--color-bg, #1c1b18);
}
[data-theme="dark"] .wm-gallery-card {
  border-color: var(--color-border, rgba(255, 255, 255, 0.12));
}
[data-theme="dark"] .wm-gallery-add-btn {
  background: var(--color-bg, #1c1b18);
  border-color: var(--color-border, rgba(255, 255, 255, 0.12));
}
[data-theme="dark"] .wm-tpl-pin {
  background: var(--color-bg, #1c1b18);
}
[data-theme="dark"] .wm-tpl-pinned {
  border-color: rgba(240, 180, 41, 0.2);
  background: rgba(240, 180, 41, 0.05);
}
[data-theme="dark"] .wm-tpl-divider {
  background: var(--color-border, rgba(255, 255, 255, 0.12));
}
[data-theme="dark"] .wm-sheet {
  background: var(--color-card, #2b2a27);
}
[data-theme="dark"] .wm-sheet-drag-pill {
  background: rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .wm-sheet-close {
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .wm-sheet-tabs {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .wm-sheet-tab.active {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}
[data-theme="dark"] .wm-sheet-card {
  border-color: var(--color-border, rgba(255, 255, 255, 0.12));
}
[data-theme="dark"] .wm-suggest-toast {
  background: var(--color-card, #2b2a27);
  border-color: var(--color-border, rgba(255, 255, 255, 0.12));
  box-shadow: 0 4px 20px rgba(20, 18, 15, 0.35);
}
[data-theme="dark"] .wm-chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--color-text-primary, #e8e6e1);
}
[data-theme="dark"] .wm-chip-all {
  background: rgba(255, 255, 255, 0.03);
  border-color: transparent;
}
@media (max-width: 768px) {
  [data-theme="dark"] .wm-mic-btn {
    background: rgba(74, 122, 104, 0.12);
    border-color: rgba(74, 122, 104, 0.25);
    color: #6db89e;
  }
  [data-theme="dark"] .wm-mic-btn.ss-mic--recording {
    background: rgba(194, 75, 96, 0.15);
    border-color: rgba(194, 75, 96, 0.3);
    color: #e06b82;
  }
  [data-theme="dark"] .wm-submit {
    box-shadow:
      0 -4px 12px rgba(0, 0, 0, 0.25),
      0 2px 6px rgba(20, 18, 15, 0.3);
  }
}
[data-theme="dark"] .wm-recording-indicator {
  background: rgba(194, 75, 96, 0.1);
  border-color: rgba(194, 75, 96, 0.2);
  color: #e06b82;
}
[data-theme="dark"] .wm-recording-dot {
  background: #e06b82;
}
/* ── Kladde panel (post-generation sidebar) ──────────────── */
.wm-kladde-panel {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wm-kladde-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--skv2-rose-dark, #9B6050);
}
.wm-kladde-header svg { color: var(--skv2-rose-dark, #9B6050); }
.wm-kladde-section { display: flex; flex-direction: column; gap: 6px; }
.wm-kladde-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
}
.wm-kladde-tone-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.wm-kladde-tone-desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.wm-kladde-tone-track {
  position: relative;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  cursor: pointer;
}
.wm-kladde-tone-progress {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: var(--skv2-rose-dark, #9B6050);
  border-radius: 3px;
  transition: width 150ms ease;
}
.wm-kladde-tone-thumb {
  position: absolute;
  top: 50%;
  width: 16px; height: 16px;
  background: var(--skv2-rose-dark, #9B6050);
  border: 2px solid var(--color-card, #fff);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: left 150ms ease;
}
.wm-kladde-tone-thumb:active { cursor: grabbing; }
.wm-kladde-tone-endpoints {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-tertiary);
}
.wm-kladde-actions {
  display: flex;
  gap: 8px;
}
.wm-kladde-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, opacity 150ms ease;
  flex: 1;
  justify-content: center;
}
.wm-kladde-btn--primary {
  background: var(--skv2-rose-dark, #9B6050);
  color: #fff;
}
.wm-kladde-btn--primary:hover { opacity: 0.9; }
.wm-kladde-btn--secondary {
  background: rgba(var(--skv2-rose-dark-rgb, 155, 96, 80), 0.10);
  color: var(--skv2-rose-dark, #9B6050);
}
.wm-kladde-btn--secondary:hover {
  background: rgba(var(--skv2-rose-dark-rgb, 155, 96, 80), 0.16);
}
.wm-kladde-btn--commit {
  background: rgba(74, 122, 104, 0.10);
  color: #4a7a68;
  border: 0.5px solid #4a7a68;
  width: 100%;
}
.wm-kladde-btn--commit:hover { background: rgba(74, 122, 104, 0.18); }
.wm-kladde-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.wm-kladde-btn.loading { opacity: 0.6; pointer-events: none; }
.wm-kladde-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--color-text-tertiary);
}
.wm-kladde-divider::before,
.wm-kladde-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.wm-kladde-refine {
  display: flex;
  gap: 8px;
}
.wm-kladde-refine-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
  flex: 1;
  justify-content: center;
}
.wm-kladde-refine-btn:hover {
  border-color: var(--skv2-rose-dark, #9B6050);
  color: var(--skv2-rose-dark, #9B6050);
  background: rgba(var(--skv2-rose-dark-rgb, 155, 96, 80), 0.04);
}
.wm-kladde-refine-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.wm-kladde-refine-btn.loading { opacity: 0.6; pointer-events: none; }
.wm-kladde-commit { margin-top: 4px; }

[data-theme="dark"] .wm-kladde-panel { }
[data-theme="dark"] .wm-kladde-btn--primary {
  background: var(--skv2-rose-dark, #9B6050);
}
[data-theme="dark"] .wm-kladde-btn--secondary {
  background: rgba(var(--skv2-rose-dark-rgb, 155, 96, 80), 0.14);
  color: var(--skv2-rose, #D4A89A);
}
[data-theme="dark"] .wm-kladde-btn--secondary:hover {
  background: rgba(var(--skv2-rose-dark-rgb, 155, 96, 80), 0.22);
}
[data-theme="dark"] .wm-kladde-refine-btn {
  border-color: rgba(255,255,255,0.12);
  color: var(--color-text-secondary);
}
[data-theme="dark"] .wm-kladde-refine-btn:hover {
  border-color: var(--skv2-rose, #D4A89A);
  color: var(--skv2-rose, #D4A89A);
  background: rgba(var(--skv2-rose-dark-rgb, 155, 96, 80), 0.08);
}
[data-theme="dark"] .wm-kladde-btn--commit {
  background: rgba(74, 122, 104, 0.14);
  color: #6fbf9f;
  border-color: rgba(74, 122, 104, 0.4);
}
[data-theme="dark"] .wm-kladde-btn--commit:hover {
  background: rgba(74, 122, 104, 0.24);
}

/* Cluster A: CSS lock — prevents switchToAiTab from overriding Kladde */
.correction-sidebar.kladde-active #ai-panel,
.correction-sidebar.kladde-active #tone-panel,
.correction-sidebar.kladde-active #chat-view,
.correction-sidebar.kladde-active #sidebar-tpl-swap,
.correction-sidebar.kladde-active .correction-inner,
.correction-sidebar.kladde-active .improv-inner,
.correction-sidebar.kladde-active .style-inner {
  display: none !important;
}
/* .sidebar-dropdown-items-container is a sibling of .correction-sidebar, not a child */
.sidebar-wrapper:has(.correction-sidebar.kladde-active) .sidebar-dropdown-items-container {
  display: none !important;
}
.correction-sidebar.kladde-active #wm-kladde-container {
  display: flex !important;
}

/* Cluster C: panel-wide loading lock */
.wm-kladde-panel.loading button,
.wm-kladde-panel.loading .wm-kladde-tone-track {
  pointer-events: none;
  opacity: 0.5;
}

/* Cluster E: focus rings for keyboard users */
.wm-kladde-btn:focus-visible,
.wm-kladde-refine-btn:focus-visible {
  outline: 2px solid var(--color-primary, #e24668);
  outline-offset: 2px;
}
.wm-kladde-tone-track:focus-visible {
  outline: 2px solid var(--color-primary, #e24668);
  outline-offset: 4px;
  border-radius: 3px;
}

/* ── Mobile: skip nudge, clean editor ─────────────────────── */
@media (max-width: 768px) {
  .wm-nudge {
    display: none !important;
  }
  .wm-form {
    display: none !important;
  }
  .grammar-page.editor-empty .top-controls.skv2-top-controls {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .grammar-page.editor-empty .counter-nav-div {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .grammar-page.editor-empty .correction-sidebar {
    pointer-events: auto !important;
  }
  .grammar-page.editor-empty .correction-sidebar > * {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

/* ── Sidebar Template Swap ── */
.sidebar-tpl-swap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 22px 18px;
  font-family: var(--font-family);
}
.sidebar-tpl-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  font-size: 11px;
  line-height: 1.3;
  color: var(--calm-muted, #9A8E82);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--calm-hairline-mid, rgba(58,47,38,0.10));
}
.sidebar-tpl-header svg { color: var(--calm-muted, #9A8E82); width: 14px; height: 14px; flex-shrink: 0; }

/* ── Add button (secondary warm chip) ── */
.sidebar-tpl-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  margin-top: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--calm-hairline-mid, rgba(58,47,38,0.10));
  border-radius: var(--calm-radius-chip, 10px);
  background: var(--calm-warm-wash, #F6F1E8);
  color: var(--calm-body, #5C4D43);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--calm-t-fast, .15s ease), border-color var(--calm-t-fast, .15s ease);
}
.sidebar-tpl-add:hover {
  background: var(--calm-hairline-wrapper, rgba(228,220,212,0.72));
}
.sidebar-tpl-add:focus-visible {
  outline: 1px solid var(--calm-sage, #6E8A7E);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px var(--calm-sage-tint-16, rgba(110,138,126,0.16));
}
.sidebar-tpl-add svg { width: 14px; height: 14px; }

/* ── Gallery back (compact header affordance) ── */
.sidebar-tpl-gallery-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 6px;
  margin-bottom: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--calm-body, #5C4D43);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--calm-t-fast, .15s ease);
}
.sidebar-tpl-gallery-back:hover {
  background: var(--calm-sage-tint-08, rgba(110,138,126,0.08));
}
.sidebar-tpl-gallery-back svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Card list ── */
.sidebar-tpl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}

/* ── Cards ── */
.sidebar-tpl-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--calm-canvas, #FFFEFB);
  border: 1px solid var(--calm-hairline-soft, rgba(58,47,38,0.06));
  cursor: pointer;
  transition: background var(--calm-t-fast, .15s ease), border-color var(--calm-t-fast, .15s ease), transform 0.15s, box-shadow 0.15s;
}
.sidebar-tpl-card:hover {
  border-color: var(--calm-hairline-mid, rgba(58,47,38,0.10));
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(58,47,38,0.06);
}
.sidebar-tpl-card:focus-visible {
  outline: 1px solid var(--calm-sage, #6E8A7E);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px var(--calm-sage-tint-16, rgba(110,138,126,0.16));
}
.sidebar-tpl-pinned { border-left: none; }
.sidebar-tpl-card.applied {
  border-color: var(--calm-sage-tint-25, rgba(110,138,126,0.25));
  background: var(--calm-sage-tint-08, rgba(110,138,126,0.08));
  box-shadow: none;
}

/* drag handle */
.sidebar-tpl-drag-handle {
  flex-shrink: 0;
  width: 14px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--calm-muted, #9A8E82);
  opacity: 0;
  cursor: grab;
  transition: opacity 0.15s;
}
.sidebar-tpl-card:hover .sidebar-tpl-drag-handle,
.sidebar-tpl-card:focus-within .sidebar-tpl-drag-handle { opacity: 0.7; }
.sidebar-tpl-drag-handle:hover { opacity: 1 !important; }
.sidebar-tpl-drag-handle:active { cursor: grabbing; }
.sidebar-tpl-dragging { opacity: 0.5; transform: scale(0.98); }
.sidebar-tpl-drag-over { border-color: var(--calm-sage, #6E8A7E); box-shadow: 0 0 0 1px var(--calm-sage, #6E8A7E); }

/* card body — grid: title+badge row 1, preview row 2 (#1613) */
.sidebar-tpl-card-body {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title badge"
    "preview preview";
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
}
.sidebar-tpl-card .sidebar-tpl-card-title {
  grid-area: title;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: var(--calm-anchor, #3A2F26);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-tpl-card .wm-tpl-tone-badge {
  grid-area: badge;
  justify-self: end;
  align-self: center;
  width: auto;
  display: inline-block;
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(58,47,38,0.05);
  border: 1px solid var(--calm-hairline-soft, rgba(58,47,38,0.06));
  color: var(--calm-body, #5C4D43);
}
.sidebar-tpl-card .sidebar-tpl-card-preview {
  grid-area: preview;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--calm-muted, #9A8E82);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* card actions — absolute, hidden at rest, reveal on hover/focus-within */
.sidebar-tpl-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(270deg, var(--calm-canvas, #FFFEFB) 70%, transparent);
  padding-left: 16px;
  border-radius: 0 10px 10px 0;
  transition: opacity 160ms ease;
}
.sidebar-tpl-card:hover .sidebar-tpl-card-actions,
.sidebar-tpl-card:focus-within .sidebar-tpl-card-actions { opacity: 1; pointer-events: auto; }
.sidebar-tpl-card-actions button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--calm-muted, #9A8E82);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  padding: 0;
}
.sidebar-tpl-card-actions button::before {
  content: '';
  position: absolute;
  inset: -8px;
  min-width: 42px;
  min-height: 42px;
}
.sidebar-tpl-card-actions button:hover {
  background: var(--calm-warm-wash, #F6F1E8);
  color: var(--calm-body, #5C4D43);
}
.sidebar-tpl-card-actions button:focus-visible {
  outline: 1px solid var(--calm-sage, #6E8A7E);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px var(--calm-sage-tint-16, rgba(110,138,126,0.16));
}
.sidebar-tpl-card-actions button svg { width: 13px; height: 13px; }
.sidebar-tpl-share { display: none; }
.sidebar-tpl-pin[data-pinned="true"] { color: var(--calm-sage, #6E8A7E) !important; }
.sidebar-tpl-pinned:not(:hover):not(:focus-within) .sidebar-tpl-card-actions { opacity: 1; pointer-events: auto; }
.sidebar-tpl-pinned:not(:hover):not(:focus-within) .sidebar-tpl-edit,
.sidebar-tpl-pinned:not(:hover):not(:focus-within) .sidebar-tpl-delete { opacity: 0; pointer-events: none; }
.sidebar-tpl-delete:hover { color: #9B6050 !important; background: rgba(155, 96, 80, 0.08) !important; }
.sidebar-tpl-delete.sidebar-tpl-delete-confirm { color: #9B6050 !important; background: rgba(155, 96, 80, 0.12) !important; opacity: 1; pointer-events: auto; }

/* ── Empty & loading states ── */
.sidebar-tpl-empty {
  padding: 16px 4px;
  color: var(--calm-muted, #9A8E82);
  font-size: 13px;
  line-height: 1.5;
}
.sidebar-tpl-empty svg { display: none; }
.sidebar-tpl-empty p { margin: 0; font-size: 13px; }
.sidebar-tpl-empty-hint { display: none; }
.sidebar-tpl-loading { padding: 24px; text-align: center; color: var(--color-text-secondary); font-size: 13px; }

/* ── Form view ── */
.sidebar-tpl-form { padding: 0; }
.sidebar-tpl-form-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--color-border, #e4dcd4);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-primary, #1a1a2e);
}
.sidebar-tpl-form-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary, #6c757d);
  cursor: pointer;
  transition: background 0.12s;
  padding: 0;
}
.sidebar-tpl-form-back:hover { background: var(--calm-sage-tint-08, rgba(110,138,126,0.08)); }
.sidebar-tpl-form-back svg { width: 16px; height: 16px; }

.sidebar-tpl-field { margin-bottom: 12px; }
.sidebar-tpl-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary, #6c757d);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sidebar-tpl-field input,
.sidebar-tpl-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #e4dcd4);
  border-radius: 6px;
  background: var(--color-card, #fff);
  color: var(--color-text-primary, #1a1a2e);
  font-family: var(--font-family);
  font-size: 13px;
  resize: vertical;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.sidebar-tpl-field input:focus,
.sidebar-tpl-field textarea:focus {
  outline: none;
  border-color: var(--skv2-rose-dark, #9B6050);
}

/* tone pills */
.sidebar-tpl-tone-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.sidebar-tpl-tone-pill {
  padding: 4px 10px;
  border: 1px solid var(--color-border, #e4dcd4);
  border-radius: 12px;
  background: transparent;
  color: var(--color-text-secondary, #6c757d);
  font-family: var(--font-family);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.sidebar-tpl-tone-pill:hover { border-color: var(--calm-sage, #6E8A7E); color: var(--calm-sage, #6E8A7E); }
.sidebar-tpl-tone-pill.active {
  background: var(--calm-sage, #6E8A7E);
  border-color: var(--calm-sage, #6E8A7E);
  color: #fff;
}

/* save button */
.sidebar-tpl-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  margin-top: 16px;
  border: none;
  border-radius: var(--calm-radius-icon-sm, 8px);
  background: var(--calm-sage, #6E8A7E);
  color: #fff;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--calm-t-fast, .15s ease), opacity 0.15s;
}
.sidebar-tpl-save-btn:hover { background: var(--calm-sage-dark, #4A7A68); }
.sidebar-tpl-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sidebar-tpl-save-btn svg { width: 14px; height: 14px; }
.sidebar-tpl-save-loader {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sidebar-tpl-spin 0.6s linear infinite;
}
.sidebar-tpl-save-btn.saving .sidebar-tpl-save-text { display: none; }
.sidebar-tpl-save-btn.saving .sidebar-tpl-save-loader { display: inline-block; }
@keyframes sidebar-tpl-spin { to { transform: rotate(360deg); } }

/* ── Calm template form polish (#1588) ── */
#calm-sidebar-tpl-form-polish {
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: transparent;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-form-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 14px;
  margin: 0 0 4px;
  border-bottom: 1px solid var(--calm-hairline-soft, rgba(58,47,38,0.06));
  font-weight: 650;
  font-size: 15px;
  color: var(--calm-anchor, #3A2F26);
  line-height: 1.3;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-form-back {
  width: 32px;
  height: 32px;
  border: 1px solid var(--calm-hairline-mid, rgba(58,47,38,0.10));
  border-radius: 10px;
  background: transparent;
  color: var(--calm-body, #5C4D43);
  cursor: pointer;
  transition: background 0.12s;
  padding: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-form-back::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-form-back:hover {
  background: var(--calm-warm-wash, rgba(58,47,38,0.04));
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-form-back:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(110,138,126,0.35);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-form-back.confirming {
  width: auto;
  min-width: 44px;
  padding: 0 10px;
  border-color: var(--calm-caution, #A0522D);
  color: var(--calm-caution, #A0522D);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-discard-text {
  display: none;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-form-back.confirming .sidebar-tpl-discard-text {
  display: inline;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-form-back svg { width: 14px; height: 14px; }
#calm-sidebar-tpl-form-polish .sidebar-tpl-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 0;
  background: transparent;
  border: none;
  padding: 0;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-field label {
  display: block;
  font-size: 11px;
  font-weight: 650;
  color: var(--calm-muted, #9A8E82);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  line-height: 1;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-field input,
#calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--calm-hairline-mid, rgba(58,47,38,0.10));
  border-radius: 14px;
  background: #FFFEFB;
  color: var(--calm-anchor, #3A2F26);
  font-family: var(--font-family);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-field input::placeholder,
#calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea::placeholder {
  color: var(--calm-muted, #9A8E82);
  opacity: 1;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-field input:hover,
#calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea:hover {
  border-color: rgba(58,47,38,0.16);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-field input:focus,
#calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea:focus {
  outline: none;
  border-color: var(--calm-sage, #6E8A7E);
  box-shadow: none;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea {
  min-height: 120px;
  resize: vertical;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-tone-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-tone-pill {
  height: 30px;
  padding: 6px 12px;
  border: 1px solid var(--calm-hairline-mid, rgba(58,47,38,0.10));
  border-radius: 10px;
  background: transparent;
  color: var(--calm-body, #5C4D43);
  font-family: var(--font-family);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-sizing: border-box;
  position: relative;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-tone-pill::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 40px;
  transform: translateY(-50%);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-tone-pill:hover {
  background: var(--calm-warm-wash, rgba(58,47,38,0.04));
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-tone-pill.active {
  background: rgba(110,138,126,0.14);
  border-color: rgba(110,138,126,0.55);
  color: var(--calm-sage-dark, #4A7A68);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-tone-pill:focus-visible {
  outline: none;
  border-color: var(--calm-sage, #6E8A7E);
  box-shadow: 0 0 0 3px rgba(110,138,126,0.35);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  margin-top: 0;
  border: 1px solid var(--calm-hairline-mid, rgba(58,47,38,0.10));
  border-radius: 12px;
  background: var(--calm-warm-wash, rgba(58,47,38,0.04));
  color: var(--calm-body, #5C4D43);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  box-shadow: none;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn:hover:not(:disabled) {
  background: rgba(110,138,126,0.14);
  border-color: rgba(110,138,126,0.55);
  color: var(--calm-sage-dark, #4A7A68);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn:focus-visible {
  outline: none;
  background: rgba(110,138,126,0.14);
  border-color: var(--calm-sage, #6E8A7E);
  color: var(--calm-sage-dark, #4A7A68);
  box-shadow: 0 0 0 3px rgba(110,138,126,0.35);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn svg { width: 14px; height: 14px; }
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn.is-saving .sidebar-tpl-save-icon,
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn.saving .sidebar-tpl-save-icon { display: none; }
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn.is-saving .sidebar-tpl-save-text,
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn.saving .sidebar-tpl-save-text { display: inline; }
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn.is-saving .sidebar-tpl-save-loader,
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn.saving .sidebar-tpl-save-loader {
  display: inline-block;
  border-color: rgba(110,138,126,0.3);
  border-top-color: var(--calm-sage, #6E8A7E);
}
#calm-sidebar-tpl-form-polish .sidebar-tpl-save-error {
  font-size: 12.5px;
  color: var(--calm-caution, #A0522D);
  padding: 8px 0 0;
  line-height: 1.4;
}
@media (prefers-reduced-motion: reduce) {
  #calm-sidebar-tpl-form-polish .sidebar-tpl-form-back,
  #calm-sidebar-tpl-form-polish .sidebar-tpl-field input,
  #calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea,
  #calm-sidebar-tpl-form-polish .sidebar-tpl-tone-pill,
  #calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn { transition: none; }
  #calm-sidebar-tpl-form-polish .sidebar-tpl-save-loader { animation: none; }
}
@media (max-width: 380px) {
  #calm-sidebar-tpl-form-polish { padding: 18px 14px; }
}
@media (max-width: 320px) {
  #calm-sidebar-tpl-form-polish { padding: 16px 12px; }
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-form-header {
  color: var(--color-text-primary, #e8e6e1);
  border-bottom-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-form-back {
  border-color: rgba(255,255,255,0.12);
  color: var(--color-text-secondary, #a0a0a0);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-form-back:hover {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-form-back.confirming {
  border-color: #C4785A;
  color: #C4785A;
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-field label {
  color: var(--color-text-secondary, #a0a0a0);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-field input,
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea {
  background: #353432;
  border-color: rgba(255,255,255,0.12);
  color: var(--color-text-primary, #e8e6e1);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-field input:hover,
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea:hover {
  border-color: rgba(255,255,255,0.18);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-field input:focus,
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea:focus {
  border-color: rgba(110,138,126,0.5);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-field input::placeholder,
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-field textarea::placeholder {
  color: var(--color-text-secondary, #a0a0a0);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-tone-pill {
  border-color: rgba(255,255,255,0.1);
  color: var(--color-text-secondary, #a0a0a0);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-tone-pill:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(110,138,126,0.5);
  color: rgba(110,138,126,0.8);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-tone-pill.active {
  background: rgba(110,138,126,0.2);
  border-color: rgba(110,138,126,0.5);
  color: rgba(110,138,126,0.9);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: var(--color-text-secondary, #a0a0a0);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-save-btn:hover:not(:disabled) {
  background: rgba(110,138,126,0.2);
  border-color: rgba(110,138,126,0.5);
  color: rgba(110,138,126,0.9);
}
[data-theme="dark"] #calm-sidebar-tpl-form-polish .sidebar-tpl-save-error {
  color: #C4785A;
}

/* ── Shared section ── */
.sidebar-tpl-shared-section { margin-top: 16px; }
.sidebar-tpl-shared-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary, #6c757d);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border, #e4dcd4);
  margin-bottom: 6px;
}
.sidebar-tpl-shared-header svg { width: 14px; height: 14px; }
.sidebar-tpl-shared-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--color-text-secondary, #6c757d);
  transition: transform 0.2s;
}
.sidebar-tpl-shared-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.sidebar-tpl-shared-toggle svg { width: 14px; height: 14px; }
.sidebar-tpl-shared-list { display: flex; flex-direction: column; gap: 6px; }
.sidebar-tpl-shared-list[hidden] { display: none; }

/* shared card variant */
.sidebar-tpl-card-shared {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--color-card, #fff);
  border: 1px solid var(--color-border, #e4dcd4);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sidebar-tpl-card-shared:hover {
  background: var(--calm-warm-wash, #F6F1E8);
  border-color: var(--calm-hairline-mid, rgba(58,47,38,0.10));
}
.sidebar-tpl-shared-by {
  display: block;
  font-size: 11px;
  color: var(--color-text-secondary, #6c757d);
  margin-top: 2px;
  font-style: italic;
}
.sidebar-tpl-unavailable {
  display: inline-block;
  font-size: 11px;
  color: #c0392b;
  opacity: 0.7;
}
.sidebar-tpl-fork-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 10px;
  border: 1px solid var(--calm-hairline-mid, rgba(58,47,38,0.10));
  border-radius: 6px;
  background: transparent;
  color: var(--calm-sage, #6E8A7E);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.sidebar-tpl-fork-btn:hover { background: var(--calm-sage-tint-08, rgba(110,138,126,0.08)); border-color: var(--calm-sage, #6E8A7E); }
.sidebar-tpl-fork-btn svg { width: 12px; height: 12px; }

/* ── Gallery button (secondary warm chip, mirrors .sidebar-tpl-add) ── */
.sidebar-tpl-gallery-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  margin-top: 8px;
  border: 1px solid var(--calm-hairline-mid, rgba(58,47,38,0.10));
  border-radius: var(--calm-radius-chip, 10px);
  background: var(--calm-warm-wash, #F6F1E8);
  color: var(--calm-body, #5C4D43);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--calm-t-fast, .15s ease), border-color var(--calm-t-fast, .15s ease);
}
.sidebar-tpl-gallery-btn:hover {
  background: var(--calm-hairline-wrapper, rgba(228,220,212,0.72));
}
.sidebar-tpl-gallery-btn:focus-visible {
  outline: 1px solid var(--calm-sage, #6E8A7E);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px var(--calm-sage-tint-16, rgba(110,138,126,0.16));
}
.sidebar-tpl-gallery-btn svg { width: 14px; height: 14px; }

/* ── Dark mode ── */
[data-theme="dark"] .sidebar-tpl-header { color: rgba(255,255,255,0.5) !important; border-bottom-color: rgba(255,255,255,0.08) !important; }
[data-theme="dark"] .sidebar-tpl-header svg { color: rgba(255,255,255,0.4) !important; }
[data-theme="dark"] .sidebar-tpl-add { background: rgba(255,255,255,0.06) !important; border-color: rgba(255,255,255,0.1) !important; color: var(--color-text-secondary) !important; }
[data-theme="dark"] .sidebar-tpl-add:hover { background: rgba(255,255,255,0.1) !important; }
[data-theme="dark"] .sidebar-tpl-gallery-back { color: var(--color-text-secondary); }
[data-theme="dark"] .sidebar-tpl-gallery-back:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .sidebar-tpl-card { background: var(--color-card) !important; border-color: rgba(255,255,255,0.08) !important; }
[data-theme="dark"] .sidebar-tpl-card:hover { border-color: rgba(255,255,255,0.16) !important; box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important; }
[data-theme="dark"] .sidebar-tpl-card-title { color: var(--color-text-primary) !important; }
[data-theme="dark"] .sidebar-tpl-card-preview { color: var(--color-text-secondary) !important; }
[data-theme="dark"] .sidebar-tpl-card-actions { background: linear-gradient(270deg, var(--color-card, #2a2927) 70%, transparent) !important; }
[data-theme="dark"] .sidebar-tpl-card-actions button { color: var(--color-text-secondary) !important; }
[data-theme="dark"] .sidebar-tpl-card-actions button:hover { background: rgba(255,255,255,0.08) !important; color: var(--color-text-primary) !important; }
[data-theme="dark"] .sidebar-tpl-pin[data-pinned="true"] { color: rgba(110,138,126,0.7) !important; }
[data-theme="dark"] .sidebar-tpl-drag-handle { color: var(--color-text-secondary); }
[data-theme="dark"] .sidebar-tpl-drag-over { border-color: rgba(110,138,126,0.5); box-shadow: 0 0 0 1px rgba(110,138,126,0.5); }
[data-theme="dark"] .sidebar-tpl-card .wm-tpl-tone-badge { background: rgba(255,255,255,0.06) !important; border-color: rgba(255,255,255,0.08) !important; color: var(--color-text-secondary) !important; }
[data-theme="dark"] .sidebar-tpl-form-header { color: var(--color-text-primary); border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .sidebar-tpl-field label { color: var(--color-text-primary, #e8e6e1); }
[data-theme="dark"] .sidebar-tpl-field input,
[data-theme="dark"] .sidebar-tpl-field textarea { background: #353432; border-color: rgba(255,255,255,0.12); color: var(--color-text-primary); }
[data-theme="dark"] .sidebar-tpl-field input:focus,
[data-theme="dark"] .sidebar-tpl-field textarea:focus { border-color: rgba(110,138,126,0.5); background: #3a3937; }
[data-theme="dark"] .sidebar-tpl-tone-pill { border-color: rgba(255,255,255,0.1); color: var(--color-text-secondary); }
[data-theme="dark"] .sidebar-tpl-tone-pill:hover { border-color: rgba(110,138,126,0.5); color: rgba(110,138,126,0.8); }
[data-theme="dark"] .sidebar-tpl-tone-pill.active { background: rgba(110,138,126,0.35); border-color: rgba(110,138,126,0.5); color: #fff; }
[data-theme="dark"] .sidebar-tpl-save-btn { background: rgba(110,138,126,0.3); color: #fff; }
[data-theme="dark"] .sidebar-tpl-save-btn:hover { background: rgba(110,138,126,0.4); }
[data-theme="dark"] .sidebar-tpl-shared-header { color: var(--color-text-secondary); border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .sidebar-tpl-card-shared { background: var(--color-card); border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .sidebar-tpl-card-shared:hover { background: rgba(110,138,126,0.08); border-color: rgba(110,138,126,0.2); }
[data-theme="dark"] .sidebar-tpl-fork-btn { color: rgba(110,138,126,0.7); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .sidebar-tpl-fork-btn:hover { background: rgba(110,138,126,0.08); border-color: rgba(110,138,126,0.4); }
[data-theme="dark"] .sidebar-tpl-gallery-btn { background: rgba(255,255,255,0.06) !important; border-color: rgba(255,255,255,0.1) !important; color: var(--color-text-secondary) !important; }
[data-theme="dark"] .sidebar-tpl-gallery-btn:hover { background: rgba(255,255,255,0.1) !important; }
[data-theme="dark"] .sidebar-tpl-empty { color: var(--color-text-secondary) !important; }
[data-theme="dark"] .sidebar-tpl-delete.sidebar-tpl-delete-confirm { background: rgba(192, 57, 43, 0.15) !important; }

/* ── Pinned dividers ── */
.sidebar-tpl-divider {
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--calm-muted, #9A8E82);
  padding: 8px 0 4px;
}
[data-theme="dark"] .sidebar-tpl-divider { color: var(--color-text-secondary); }

/* ── Touch / coarse pointer ── */
@media (pointer: coarse) {
  .sidebar-tpl-drag-handle { opacity: 0.5 !important; }
  .sidebar-tpl-card-actions { opacity: 1 !important; pointer-events: auto !important; }
  .sidebar-tpl-pinned .sidebar-tpl-pin { opacity: 1 !important; pointer-events: auto !important; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .sidebar-tpl-card { transition: none !important; }
  .sidebar-tpl-card:hover { transform: none !important; box-shadow: none !important; }
  .sidebar-tpl-card-actions { transition: none !important; }
  .sidebar-tpl-drag-handle { transition: none !important; }
  .sidebar-tpl-dragging { transform: none !important; }
}

/* ── Keyboard reorder live region ── */
.sidebar-tpl-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Template login gate (anonymous users) ── */
.sidebar-tpl-swap { position: relative; }

.ss-tpl-login-gate {
  position: absolute;
  z-index: 100;
  width: 280px;
  max-width: calc(100% - 16px);
  padding: 18px 18px 16px;
  background: #FFFEFB;
  color: #3A2F26;
  border: 1px solid rgba(58,47,38,.10);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(58,47,38,.08);
  font-family: var(--font-family);
  left: 50%;
  transform: translateX(-50%);
}
.ss-tpl-login-gate__title {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  color: #3A2F26;
}
.ss-tpl-login-gate__body {
  margin: 0 0 14px;
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.45;
  color: #5C4D43;
}
.ss-tpl-login-gate__actions {
  display: flex;
  gap: 8px;
}
.ss-tpl-login-gate__login {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: #6E8A7E;
  color: #FFFEFB;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease;
}
.ss-tpl-login-gate__login:hover { background: #5C7A6E; }
.ss-tpl-login-gate__login:focus-visible { outline: 2px solid #3A2F26 !important; outline-offset: 2px; }
.ss-tpl-login-gate__dismiss {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 10px 14px;
  border: 1px solid rgba(58,47,38,.12);
  border-radius: 10px;
  background: transparent;
  color: #5C4D43;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.ss-tpl-login-gate__dismiss:hover { background: #FBF8F2; border-color: rgba(58,47,38,.18); }
.ss-tpl-login-gate__dismiss:focus-visible { outline: 2px solid #6E8A7E !important; outline-offset: 2px; }
.ss-tpl-login-gate__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #9A8E82;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.ss-tpl-login-gate__close:hover { background: #FBF8F2; color: #5C4D43; }
.ss-tpl-login-gate__close:focus-visible { outline: 2px solid #6E8A7E !important; outline-offset: 2px; }

/* Dark theme */
html[data-theme="dark"] .ss-tpl-login-gate {
  background: #1f1e1c;
  color: #e8e6e1;
  border-color: rgba(232,230,225,.10);
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
html[data-theme="dark"] .ss-tpl-login-gate__title { color: #e8e6e1; }
html[data-theme="dark"] .ss-tpl-login-gate__body { color: #a09a93; }
html[data-theme="dark"] .ss-tpl-login-gate__login { background: #6E8A7E; color: #FFFEFB; }
html[data-theme="dark"] .ss-tpl-login-gate__login:hover { background: #5C7A6E; }
html[data-theme="dark"] .ss-tpl-login-gate__dismiss { color: #a09a93; border-color: rgba(232,230,225,.15); }
html[data-theme="dark"] .ss-tpl-login-gate__dismiss:hover { background: rgba(232,230,225,.06); color: #e8e6e1; border-color: rgba(232,230,225,.25); }
html[data-theme="dark"] .ss-tpl-login-gate__close { color: #a09a93; }
html[data-theme="dark"] .ss-tpl-login-gate__close:hover { background: rgba(232,230,225,.08); color: #e8e6e1; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ss-tpl-login-gate__login,
  .ss-tpl-login-gate__dismiss,
  .ss-tpl-login-gate__close { transition: none; }
}
