/* ═════════════════════════════════════════════════════════════════════
   VG CERTIFICATE STUDIO — PRODUCTION DESIGN SYSTEM (BLACK & WHITE)
   ═════════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #09090b;
  --bg-dots: #121215;
  --surface: #121215;
  --surface2: #18181b;
  --surface3: #222226;
  --surface-hover: #27272a;
  
  --border: #27272a;
  --border-subtle: #1e1e22;
  --border-focus: #52525b;
  
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --accent: #ffffff;
  --accent-text: #000000;
  --accent-subtle: rgba(255, 255, 255, 0.08);
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.8);
  --shadow-hud: 0 8px 32px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ─── Studio Header ─────────────────────────────────── */
.studio-header {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-monogram {
  width: 30px;
  height: 30px;
  background: #ffffff;
  color: #000000;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: -0.5px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title-row h1 {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.badge-pro {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.system-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.status-pulse {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.status-text {
  font-size: 9px;
  font-weight: 700;
  color: var(--success);
  letter-spacing: 0.06em;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  display: none;
}

@media (min-width: 1024px) {
  .brand-subtitle { display: block; }
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-hdr {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.btn-hdr:hover {
  background: var(--surface-hover);
  border-color: #52525b;
  color: #ffffff;
}

.btn-hdr-primary {
  background: #ffffff;
  color: #000000;
  font-weight: 700;
  border: 1px solid #ffffff;
}

.btn-hdr-primary:hover {
  background: #e4e4e7;
  color: #000000;
  box-shadow: 0 2px 12px rgba(255, 255, 255, 0.2);
}

.smtp-pill-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.smtp-pill-badge.configured {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

/* Dropdown Menu */
.dropdown-wrap {
  position: relative;
}

.export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 0.15s ease;
  z-index: 200;
}

.dropdown-wrap.open .export-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.export-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  font-family: inherit;
  width: 100%;
}

.export-item:hover {
  background: var(--surface2);
  color: #ffffff;
}

.export-item svg {
  margin-top: 2px;
  flex-shrink: 0;
  opacity: 0.7;
}

.export-item:hover svg {
  opacity: 1;
}

.export-item-info {
  display: flex;
  flex-direction: column;
}

.export-item-title {
  font-size: 12px;
  font-weight: 600;
}

.export-item-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.export-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ─── Studio Main App Layout ───────────────────────── */
.studio-app {
  display: flex;
  height: calc(100vh - 52px);
  width: 100vw;
  overflow: hidden;
}

/* ─── Studio Sidebar ────────────────────────────────── */
.studio-sidebar {
  width: 340px;
  min-width: 320px;
  max-width: 360px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  flex-shrink: 0;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.sidebar-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-tab.active {
  background: var(--surface);
  border-color: var(--border);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  flex-direction: column;
  gap: 16px;
}

.tab-content.active {
  display: flex;
}

.tab-content::-webkit-scrollbar { width: 4px; }
.tab-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Sidebar Sections */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header h3 {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-badge, .hint-pill {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.active-field-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-field-badge.has-field {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  font-weight: 700;
}

/* Form Controls */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label, .field-header-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-auto-size {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1.4;
}

.btn-auto-size:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

.row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

input[type="text"], input[type="number"], input[type="password"], input[type="email"], select {
  width: 100%;
  height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  padding: 0 10px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus {
  border-color: #ffffff;
}

.color-input-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}

.color-input-wrap input[type="color"] {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  cursor: pointer;
  flex-shrink: 0;
}

.color-input-wrap input[type="text"] {
  flex: 1;
}

/* Segmented Buttons */
.segmented-control {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.segment-btn {
  flex: 1;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  font-family: inherit;
}

.segment-btn:hover {
  color: var(--text);
}

.segment-btn.active {
  background: #ffffff;
  color: #000000;
  box-shadow: var(--shadow-sm);
}

/* Switch Toggle */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  cursor: pointer;
}

.switch-toggle input { opacity: 0; width: 0; height: 0; }

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: 0.2s;
}

.switch-slider::before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.2s;
}

.switch-toggle input:checked + .switch-slider {
  background: #ffffff;
  border-color: #ffffff;
}

.switch-toggle input:checked + .switch-slider::before {
  transform: translateX(16px);
  background: #000000;
}

.shadow-controls {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.shadow-controls.visible {
  display: flex;
}

.label-with-val {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

/* Nudge Controls */
.nudge-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.nudge-mid-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  justify-content: center;
}

.btn-nudge {
  width: 32px;
  height: 28px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.12s;
  font-family: inherit;
}

.btn-nudge:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.btn-nudge-center {
  width: auto;
  padding: 0 12px;
  font-weight: 600;
  font-size: 11px;
}

.pos-badges {
  display: flex;
  gap: 6px;
}

.pos-tag {
  font-size: 10px;
  font-family: 'Courier New', monospace;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}

.btn-danger-outline {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-danger-outline:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

/* Upload Dropzone */
.upload-dropzone {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px 14px;
  background: rgba(24, 24, 27, 0.4);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-dropzone:hover, .upload-dropzone.drag-over {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.03);
}

.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.upload-inner svg { color: var(--text-muted); }
.upload-title { font-size: 12px; font-weight: 600; color: #ffffff; }
.upload-hint { font-size: 10px; color: var(--text-muted); }

.btn-subtle {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-subtle:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

/* Column Tokens */
.column-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.col-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  transition: all 0.15s;
}

.col-chip:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

.col-chip.dragging {
  opacity: 0.4;
}

/* Data Table */
.excel-table-container {
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
}

.excel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.excel-table th {
  position: sticky;
  top: 0;
  background: var(--surface3);
  color: var(--text-muted);
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.excel-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.excel-table tr:hover { background: var(--surface-hover); }
.excel-table tr.active { background: rgba(255, 255, 255, 0.12) !important; outline: 1px solid #ffffff; outline-offset: -1px; }

.btn-text-danger {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 11px;
  cursor: pointer;
}

.btn-text-action {
  background: transparent;
  border: none;
  color: #ffffff;
  text-decoration: underline;
  font-size: 11px;
  cursor: pointer;
}

/* Template Cards */
.template-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.template-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
}

.template-card:hover {
  border-color: #52525b;
}

.template-card.active {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 1px #ffffff;
}

.template-thumb {
  width: 60px;
  height: 42px;
  border-radius: 4px;
  border: 1px solid #3f3f46;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 2px;
  flex-shrink: 0;
}

.thumb-luxury { background: linear-gradient(135deg, #000 0%, #27272a 100%); }
.thumb-custom {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.thumb-badge {
  font-size: 8px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.85);
  color: #a1a1aa;
  padding: 1px 4px;
  border-radius: 2px;
}

.template-name {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Custom Template Saved Cards */
.custom-template-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
  width: 100%;
}

.custom-template-card:hover {
  border-color: #52525b;
}

.custom-template-card.active {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 1px #ffffff;
}

.custom-template-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.custom-template-meta {
  font-size: 10px;
  color: var(--text-muted);
}

.btn-delete-custom-tpl {
  position: relative;
  z-index: 5;
  width: 28px;
  height: 28px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 4px;
  color: var(--danger);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
  flex-shrink: 0;
  pointer-events: auto;
}

.btn-delete-custom-tpl * {
  pointer-events: none;
}

.btn-delete-custom-tpl:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

/* Security & On-Device Privacy Box */
.security-card {
  background: rgba(24, 24, 27, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.security-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.security-header svg {
  color: #ffffff;
}

.security-card p {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* SMTP Overview & Dispatch */
.smtp-overview-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.smtp-overview-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.smtp-lbl { color: var(--text-muted); }
.smtp-val { color: #ffffff; font-weight: 600; }

.subject-preview-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-primary-action {
  width: 100%;
  padding: 10px 14px;
  background: #ffffff;
  color: #000000;
  border: 1px solid #ffffff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary-action:hover {
  background: #e4e4e7;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.2);
}

.btn-primary-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Center Canvas Studio Workspace & Stage ────────── */
.studio-canvas-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  width: 100%;
}

.studio-canvas-workspace {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
  background-size: 24px 24px;
  position: relative;
  overflow: auto;
  padding: 68px 32px 32px 32px;
}

/* Floating Top Canvas HUD - Permanently Fixed in View */
.canvas-floating-hud {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 50;
  max-width: calc(100% - 32px);
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: none;
}

.canvas-floating-hud > * {
  pointer-events: auto;
}

.hud-recipient-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(18, 18, 21, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  box-shadow: var(--shadow-hud);
}

.hud-btn-step {
  width: 24px;
  height: 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: #ffffff;
  font-size: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.12s;
}

.hud-btn-step:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.hud-recipient-label {
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  padding: 0 8px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-btn-reset {
  background: transparent;
  border: 1px solid #3f3f46;
  border-radius: 4px;
  color: #a1a1aa;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.12s;
}

.hud-btn-reset:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.hud-action-group, .hud-zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(18, 18, 21, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  box-shadow: var(--shadow-hud);
}

.hud-tool-btn, .hud-zoom-btn {
  height: 26px;
  min-width: 26px;
  padding: 0 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.12s;
  font-family: inherit;
}

.hud-tool-btn:hover, .hud-zoom-btn:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.hud-zoom-level {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  padding: 0 6px;
  cursor: pointer;
  min-width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hud-zoom-level:hover {
  text-decoration: underline;
}

.hud-zoom-btn.text-btn {
  font-size: 10px;
  font-weight: 700;
  padding: 0 7px;
}

/* Canvas Empty State */
.canvas-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 36px;
  background: rgba(24, 24, 27, 0.7);
  backdrop-filter: blur(12px);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  margin: auto;
  gap: 14px;
}

.canvas-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: #ffffff;
  margin-bottom: 2px;
}

.canvas-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin: 0;
}

.canvas-empty-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 380px;
  margin: 0;
}

.canvas-empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.btn-empty-action {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-empty-action.primary {
  background: #ffffff;
  color: #000000;
  border: 1px solid #ffffff;
}

.btn-empty-action.primary:hover {
  background: #e4e4e7;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.btn-empty-action.secondary {
  background: var(--surface2);
  color: #ffffff;
  border: 1px solid var(--border);
}

.btn-empty-action.secondary:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

/* Canvas Container */
.canvas-container {
  position: relative;
  display: inline-block;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: #ffffff;
  cursor: crosshair;
  margin: auto;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#previewCanvas {
  display: block;
  background: #ffffff;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#previewCanvas.drop-over {
  outline: 3px dashed #ffffff;
  outline-offset: -3px;
}

/* ─── Font Picker Dropdown ─────────────────────────── */
.font-picker { position: relative; width: 100%; }

.font-trigger {
  width: 100%;
  height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s;
}

.font-trigger:hover, .font-trigger.open { border-color: #ffffff; }

.font-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
}

.font-dropdown.open { display: flex; }

.font-category-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 10px 2px;
  background: var(--surface2);
  position: sticky;
  top: 0;
}

.font-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}

.font-item:hover { background: var(--surface-hover); color: #ffffff; }
.font-item.active { background: rgba(255, 255, 255, 0.1); color: #ffffff; font-weight: 700; }
.font-item-check { width: 14px; height: 14px; opacity: 0; }
.font-item.active .font-item-check { opacity: 1; }

/* ─── Modals ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 16px;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform 0.2s;
  overflow: hidden;
}

.modal-overlay.open .modal { transform: translateY(0); }
.modal-wide { width: 680px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.modal-close {
  width: 26px;
  height: 26px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
}

.modal-close:hover { color: #ffffff; border-color: #ffffff; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary { background: #ffffff; color: #000000; border: 1px solid #ffffff; font-weight: 700; }
.btn-primary:hover { background: #e4e4e7; }
.btn-test { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-test:hover { border-color: #ffffff; color: #ffffff; }

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-smtp-help-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-smtp-help-toggle:hover, .btn-smtp-help-toggle.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.btn-inline-help {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.btn-inline-help:hover {
  color: #a1a1aa;
}

/* SMTP Setup Help Accordion Panel */
.smtp-help-panel {
  background: rgba(24, 24, 27, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: slideDownFade 0.2s ease-out;
}

@keyframes slideDownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.smtp-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.smtp-help-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

.btn-help-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.btn-help-close:hover {
  color: #ffffff;
}

.smtp-help-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.smtp-help-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 6px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
  text-align: center;
}

.smtp-help-tab:hover {
  color: #ffffff;
}

.smtp-help-tab.active {
  background: #ffffff;
  color: #000000;
  font-weight: 700;
}

.smtp-help-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.help-step-badge {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.help-steps-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.help-steps-list a {
  color: #ffffff;
  text-decoration: underline;
}

.help-steps-list code {
  background: #000000;
  border: 1px solid #3f3f46;
  color: #ffffff;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
}

.help-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.25);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 10px;
  color: #fde047;
  line-height: 1.4;
}

.help-note svg {
  flex-shrink: 0;
  margin-top: 2px;
}

/* SMTP Preset Grid */
.smtp-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.smtp-preset-btn {
  height: 30px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
}

.smtp-preset-btn:hover { color: #ffffff; border-color: #52525b; }
.smtp-preset-btn.active { background: #ffffff; color: #000000; border-color: #ffffff; }

.smtp-test-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.smtp-test-result.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.smtp-test-result.fail {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

/* Rich Email Editor */
.var-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.var-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.var-chip:hover { background: #ffffff; color: #000000; border-color: #ffffff; }
.var-chip-hint { font-size: 11px; color: var(--text-muted); font-style: italic; }

.rich-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  flex-wrap: wrap;
}

.rich-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text);
  min-width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
}
.rich-btn:hover { background: var(--surface-hover); }
.rich-btn.active { background: #ffffff; color: #000000; }
.rich-divider { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

.email-body-editor {
  min-height: 200px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  word-break: break-word;
  white-space: pre-wrap;
}
.email-body-editor:focus { border-color: #ffffff; }
.email-body-editor:empty::before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }

/* Shortcuts Grid */
.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.shortcut-desc { font-size: 12px; color: var(--text); }
kbd {
  background: #000000;
  border: 1px solid #3f3f46;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-family: 'Courier New', monospace;
  font-weight: 700;
}

/* Batch Progress Modal */
.bulk-progress-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
.bulk-progress-modal.visible { display: flex; }

.bulk-progress-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}

.bulk-progress-title { font-size: 13px; font-weight: 700; color: #ffffff; text-align: center; }

.progress-wrap {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.progress-wrap.visible { display: flex; }

.progress-bar-track {
  background: var(--surface2);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  background: #ffffff;
  height: 100%;
  width: 0%;
  transition: width 0.15s;
}
.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.email-log {
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.log-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
}
.log-row.ok { color: var(--success); }
.log-row.fail { color: var(--danger); }
.log-row span { font-weight: 600; }
.log-row small { opacity: 0.7; }

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid #3f3f46;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { border-color: var(--success); color: #ffffff; }
#toast.warning { border-color: var(--warning); color: #ffffff; }

/* ═════════════════════════════════════════════════════════════════════
   MOBILE & TABLET RESPONSIVE SYSTEM (LIVE SPLIT VIEW)
   ═════════════════════════════════════════════════════════════════════ */

/* Stepper & Swatches UI Components */
.stepper-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-stepper {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn-stepper:active {
  transform: scale(0.92);
  background: #ffffff;
  color: #000000;
}

.stepper-input-wrap input[type="number"] {
  flex: 1;
  text-align: center;
}

.color-swatches {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.color-swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  touch-action: manipulation;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch-btn:active, .color-swatch-btn:hover {
  transform: scale(1.15);
}

.color-swatch-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--accent);
}

.btn-view-toggle {
  display: none;
}

/* Floating Quick Edit Pill (shown only when canvas is maximized) */
.btn-floating-mobile-tools {
  display: none;
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: rgba(18, 18, 21, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  z-index: 90;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s, background 0.15s;
}

.btn-floating-mobile-tools:active {
  transform: scale(0.95);
  background: #ffffff;
  color: #000000;
}

/* ─── Media Queries: Large Tablets & Laptops (<= 1024px) ───────────── */
@media (max-width: 1024px) {
  .studio-sidebar {
    width: 320px;
    min-width: 300px;
  }
}

/* ─── Media Queries: Tablets & Mobile Devices Split View (<= 860px) ── */
@media (max-width: 860px) {
  .studio-header {
    height: 48px;
    padding: 0 12px;
    background: #111114;
    border-bottom: 1px solid var(--border);
  }

  .header-brand {
    gap: 0;
    min-width: 0;
  }

  .logo-monogram {
    width: 32px;
    height: 32px;
    font-size: 13px;
    font-weight: 900;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.18);
  }

  .brand-text {
    display: none !important;
  }

  .header-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  .btn-hdr {
    padding: 5px 9px;
    font-size: 11px;
    gap: 5px;
  }

  .hdr-export-label {
    display: inline;
  }

  #btnOpenShortcuts {
    display: none;
  }

  .studio-app {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 48px);
    overflow: hidden;
  }

  /* Top Viewport: Certificate Stage (Live Canvas) */
  .studio-canvas-stage {
    flex: 0 0 43vh;
    min-height: 200px;
    max-height: 48vh;
    width: 100vw;
    position: relative;
    border-bottom: 2px solid var(--border);
    background: #09090b;
    transition: flex 0.2s ease;
  }

  .studio-canvas-workspace {
    padding: 38px 8px 8px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Floating HUD on Mobile */
  .canvas-floating-hud {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 10px);
    max-width: 520px;
    padding: 3px 6px;
    gap: 4px;
    border-radius: var(--radius-full);
  }

  .hud-recipient-label {
    max-width: 110px;
    font-size: 9px;
  }

  .btn-view-toggle {
    display: inline-flex !important;
  }

  /* Bottom Viewport: Studio Control Panel Dock */
  .studio-sidebar {
    flex: 1 1 auto;
    width: 100% !important;
    max-width: 100% !important;
    position: static;
    transform: none !important;
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.6);
  }


  .sidebar-tabs {
    flex-shrink: 0;
    display: flex;
    overflow-x: auto;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    padding: 0 2px;
    gap: 2px;
  }

  .sidebar-tab {
    flex: 1;
    min-width: 70px;
    padding: 10px 4px;
    font-size: 11px;
    font-weight: 700;
    justify-content: center;
    gap: 5px;
  }

  .sidebar-tab svg {
    width: 14px;
    height: 14px;
  }

  .sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px 28px 14px;
    -webkit-overflow-scrolling: touch;
  }

  /* Full Screen Canvas Mode */
  .studio-app.canvas-maximized .studio-canvas-stage {
    flex: 1 1 100%;
    max-height: 100%;
    border-bottom: none;
  }

  .studio-app.canvas-maximized .studio-sidebar {
    display: none;
  }

  .studio-app.canvas-maximized .btn-floating-mobile-tools {
    display: inline-flex;
    bottom: 24px;
    right: 20px;
  }
}

/* ─── Media Queries: Mobile Phones (<= 640px) ───────────────────────── */
@media (max-width: 640px) {
  .logo-monogram {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .hdr-btn-text {
    display: none;
  }

  .export-menu {
    width: 220px;
    right: 0;
  }

  /* Canvas HUD on phones */
  .hud-recipient-stepper, .hud-action-group, .hud-zoom-group {
    padding: 3px 4px;
    gap: 2px;
  }

  .hud-tool-btn, .hud-zoom-btn {
    height: 24px;
    min-width: 24px;
    padding: 0 4px;
    font-size: 11px;
  }

  .hud-zoom-btn.text-btn {
    padding: 0 4px;
    font-size: 9px;
  }

  #zoom100 {
    display: none; /* Hide 1:1 button on very narrow screens */
  }

  .hud-zoom-level {
    min-width: 32px;
    font-size: 10px;
    padding: 0 3px;
  }

  .hud-recipient-label {
    max-width: 85px;
    font-size: 9px;
    padding: 0 3px;
  }

  .hud-btn-reset {
    font-size: 9px;
    padding: 1px 4px;
  }

  /* Mobile Modals */
  .modal {
    width: 96vw !important;
    max-height: 92vh !important;
    padding: 14px !important;
    border-radius: var(--radius-md) !important;
  }

  .modal-title {
    font-size: 13px !important;
  }

  .smtp-preset-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .row-2col {
    grid-template-columns: 1fr !important;
  }

  .canvas-empty-state {
    padding: 24px 14px;
    width: 95%;
  }

  .canvas-empty-title {
    font-size: 13px;
  }

  .canvas-empty-desc {
    font-size: 11px;
  }
}

/* ═════════════════════════════════════════════════════════════════════
   MOBILE DEVICE RECOMMENDATION OVERLAY SCREEN
   ═════════════════════════════════════════════════════════════════════ */
.mobile-notice-overlay {
  display: none;
}

@media (max-width: 860px) {
  .mobile-notice-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(9, 9, 11, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 20px 16px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .mobile-notice-overlay.dismissed {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .mobile-notice-card {
    background: #141417;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.08);
    animation: noticePopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes noticePopIn {
    from {
      opacity: 0;
      transform: scale(0.94) translateY(10px);
    }
    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }

  .mobile-notice-header {
    display: flex;
    justify-content: center;
  }

  .mobile-notice-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.02em;
  }

  .notice-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #eab308;
    box-shadow: 0 0 8px #eab308;
  }

  .mobile-notice-icon-wrap {
    margin: 16px auto 14px auto;
  }

  .mobile-notice-icon {
    width: 68px;
    height: 68px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  }

  .mobile-notice-title {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
    margin: 0 0 8px 0;
    line-height: 1.25;
  }

  .mobile-notice-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 16px 0;
  }

  .mobile-notice-desc strong {
    color: #ffffff;
  }

  .mobile-notice-features {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
  }

  .notice-feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: #e4e4e7;
    font-weight: 500;
  }

  .notice-feature-item svg {
    color: var(--success);
    flex-shrink: 0;
  }

  .mobile-notice-actions {
    margin-bottom: 12px;
  }

  .btn-notice-dismiss {
    width: 100%;
    padding: 12px 18px;
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s, background 0.15s;
    font-family: inherit;
  }

  .btn-notice-dismiss:active {
    transform: scale(0.98);
    background: #e4e4e7;
  }

  .mobile-notice-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
  }
}

