/* VeloMail SaaS Editor */

:root {
  --black: #07020d;
  --sky: #5db7de;
  --sky-dark: #3a9bc4;
  --sky-light: #e8f6fc;
  --dim: #716a5c;
  --muted: #a39b8b;
  --border: rgba(0, 0, 0, 0.08);
  --bg-page: #ececef;
  --bg-panel: #ffffff;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --header-h: 52px;
  --preview-pad: 28px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --pass: #166534;
  --pass-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --fail: #991b1b;
  --fail-bg: #fee2e2;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--black);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 2000;
  padding: 8px 14px;
  background: var(--sky);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

/* Header */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--black);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}
.brand img { border-radius: 7px; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s var(--ease);
  white-space: nowrap;
}
.btn-ghost:hover { background: rgba(0, 0, 0, 0.04); color: var(--black); }

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--dim);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--sky-light); color: var(--sky-dark); border-color: rgba(93, 183, 222, 0.35); }
.icon-btn[aria-pressed="true"] { background: var(--sky); color: #fff; border-color: var(--sky); }

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

/* 50/50 split — permanent side-by-side on desktop */
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - var(--header-h));
  min-height: 0;
}

/* Editor panel */
.editor-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  position: relative;
  min-width: 0;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(93, 183, 222, 0.14);
  border: 2px dashed var(--sky);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.drop-overlay span {
  font-size: 14px;
  font-weight: 600;
  color: var(--sky-dark);
  background: var(--bg-panel);
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.template-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.template-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 2px;
}

.template-chip {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.template-chip:hover { border-color: var(--sky); color: var(--sky-dark); background: var(--sky-light); }

.editor-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.meta-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meta-field-wide { grid-column: 1 / -1; }

.field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.editor-meta input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  font-size: 14px;
  color: var(--black);
  background: #fafafa;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.editor-meta input:focus { border-color: var(--sky); background: #fff; }

.editor-textarea {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 14px 16px;
  border: none;
  resize: none;
  font: inherit;
  font-size: 15px;
  line-height: 1.65;
  color: var(--black);
  background: transparent;
  outline: none;
}
.editor-textarea::placeholder { color: var(--muted); }

.editor-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--dim);
  flex-shrink: 0;
  background: #fafafa;
}

.stat-sep { color: var(--muted); }
.stat-spacer { flex: 1; min-width: 8px; }

.insight-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
  white-space: nowrap;
}
.insight-badge.pass { color: var(--pass); background: var(--pass-bg); }
.insight-badge.warn { color: var(--warn); background: var(--warn-bg); }
.insight-badge.fail { color: var(--fail); background: var(--fail-bg); }

.save-status { color: var(--muted); font-variant-numeric: tabular-nums; }
.save-status.saving { color: var(--sky); }
.save-status.saved { color: var(--pass); }

/* Preview panel */
.preview-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(180deg, #eef0f4 0%, #e4e6ec 100%);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--preview-pad);
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  flex-shrink: 0;
}

.device-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.device-select-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.device-select {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  padding: 7px 32px 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23716a5c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  cursor: pointer;
  min-width: 160px;
  max-width: 220px;
}
.device-select:hover { border-color: rgba(93, 183, 222, 0.45); }
.device-select:focus { border-color: var(--sky); background-color: #fff; outline: none; }

.preview-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: var(--preview-pad);
  min-height: 0;
  overflow: hidden;
}

.preview-hint {
  position: absolute;
  top: calc(var(--preview-pad) - 4px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.2s;
}
.preview-hint.hidden { opacity: 0; }

.device-scaler {
  transform-origin: center center;
  transition: transform 0.25s var(--ease);
  position: relative;
  flex-shrink: 0;
}

/* Phone — display-sized mockups (never render at full 393pt) */
.phone {
  --phone-w: 300px;
  --phone-h: 650px;
  --bezel: 8px;
  --frame-radius: 42px;
  --screen-radius: 36px;
  position: relative;
}

.phone-side-btn {
  position: absolute;
  background: #3a3a3c;
  border-radius: 2px;
  z-index: 0;
}
.phone-side-vol {
  left: -3px;
  top: 28%;
  width: 3px;
  height: 56px;
  box-shadow: 0 68px 0 #3a3a3c;
}
.phone-side-power {
  right: -3px;
  top: 22%;
  width: 3px;
  height: 72px;
}

.phone-frame {
  position: relative;
  background: linear-gradient(155deg, #3d3d40 0%, #1c1c1e 55%, #141416 100%);
  border: var(--bezel) solid #1c1c1e;
  border-radius: var(--frame-radius);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.2),
    0 8px 20px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  width: calc(var(--phone-w) + var(--bezel) * 2);
}

.phone-screen {
  width: var(--phone-w);
  height: var(--phone-h);
  background: #ffffff;
  border-radius: var(--screen-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: background 0.25s, color 0.25s;
}

.device-iphone-15-pro { --phone-w: 300px; --phone-h: 650px; --frame-radius: 42px; --screen-radius: 36px; }
.device-iphone-se { --phone-w: 286px; --phone-h: 508px; --frame-radius: 36px; --screen-radius: 28px; --bezel: 7px; }
.device-pixel-8-pro { --phone-w: 314px; --phone-h: 680px; --frame-radius: 32px; --screen-radius: 26px; --bezel: 6px; }

.phone[data-orientation="landscape"] .phone-frame { width: calc(var(--phone-h) + var(--bezel) * 2); }
.phone[data-orientation="landscape"] .phone-screen { width: var(--phone-h); height: var(--phone-w); }
.phone[data-orientation="landscape"] .phone-side-vol { top: 18%; height: 40px; box-shadow: 0 48px 0 #3a3a3c; }

/* Notches */
.dynamic-island {
  position: absolute;
  top: calc(var(--bezel) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 28px;
  background: #000;
  border-radius: 20px;
  z-index: 20;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.classic-notch {
  position: absolute;
  top: var(--bezel);
  left: 50%;
  transform: translateX(-50%);
  width: 118px;
  height: 22px;
  background: #1c1c1e;
  border-radius: 0 0 18px 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
}
.notch-speaker { flex: 1; height: 5px; background: #0a0a0a; border-radius: 3px; }
.notch-cam { width: 12px; height: 12px; background: #0d0d0d; border-radius: 50%; border: 1.5px solid #2a2a2a; }

.punch-hole {
  position: absolute;
  top: calc(var(--bezel) + 16px);
  left: 50%;
  transform: translateX(-50%);
  width: 11px;
  height: 11px;
  background: radial-gradient(circle at 35% 35%, #1a1a1a, #000);
  border-radius: 50%;
  z-index: 20;
  box-shadow: 0 0 0 2px #1c1c1e;
}

.phone-home-button {
  position: absolute;
  bottom: calc(var(--bezel) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  z-index: 20;
}

.home-indicator {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 102px;
  height: 4px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 100px;
  z-index: 15;
}
.device-iphone-se .home-indicator { display: none; }

/* iOS Mail chrome */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 36px 18px 6px;
  flex-shrink: 0;
  background: #ffffff;
}
.status-time { font-size: 14px; font-weight: 600; letter-spacing: -0.3px; color: #000; }
.status-icons { display: flex; align-items: center; gap: 5px; color: #000; }
.device-iphone-se .status-bar { padding-top: 28px; }
.device-pixel-8-pro .status-bar { padding-top: 32px; }

.mail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid #c6c6c8;
  flex-shrink: 0;
  background: #ffffff;
}

.mail-cancel {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 15px;
  color: #007aff;
  min-width: 68px;
}
.mail-cancel svg { stroke: #007aff; }
.mail-title { font-size: 15px; font-weight: 600; color: #000; }
.mail-send {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #007aff;
  padding: 6px 14px;
  border-radius: 16px;
  min-width: 58px;
  text-align: center;
  opacity: 0.95;
}

.mail-fields { flex-shrink: 0; background: #ffffff; }

.mail-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid #c6c6c8;
  font-size: 14px;
  min-height: 40px;
  background: #ffffff;
}

.mail-label { flex: 0 0 48px; color: #8a8a8e; font-size: 14px; font-weight: 400; }
.mail-value {
  flex: 1;
  color: #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 400;
}

.mail-row.mail-to-row .mail-value { font-weight: 400; color: #000; }

.mail-from-row { align-items: center; }
.from-details {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.from-name { font-size: 15px; font-weight: 600; color: #000; white-space: nowrap; }
.from-email {
  font-size: 13px;
  color: #8a8a8e;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-subject-row { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.mail-subject-row .mail-value { font-weight: 400; white-space: normal; line-height: 1.35; }

.subject-count {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--pass);
  background: var(--pass-bg);
}
.subject-count.warn { color: var(--warn); background: var(--warn-bg); }
.subject-count.danger { color: var(--fail); background: var(--fail-bg); }

/* Scrollable body with fold line */
.mail-scroll {
  flex: 1;
  position: relative;
  overflow-y: auto;
  min-height: 0;
  background: #ffffff;
}

.fold-line {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--fold-offset, 168px);
  border-top: 1.5px dashed rgba(93, 183, 222, 0.65);
  pointer-events: none;
  z-index: 2;
}
.fold-label {
  position: absolute;
  right: 10px;
  top: -9px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sky-dark);
  background: rgba(255, 255, 255, 0.92);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(93, 183, 222, 0.35);
}

.mail-body {
  padding: 12px 14px 20px;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.24px;
  color: #000;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
}

.mail-body p { margin-bottom: 10px; }
.mail-body p:last-child { margin-bottom: 0; }
.mail-body a { color: #007aff; text-decoration: underline; word-break: break-all; }
.mail-body .sig { color: #8a8a8e; font-size: 15px; margin-top: 4px; }

.empty-preview { color: #a39b8b; font-style: italic; font-size: 14px; }

.compose-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 40px;
  padding: 0 16px;
  border-top: 1px solid #c6c6c8;
  background: #f2f2f7;
  flex-shrink: 0;
}
.toolbar-svg { color: #8a8a8e; flex-shrink: 0; }

/* Dark preview */
.phone-screen.dark-mode { background: #000; color: #f2f2f7; }
.phone-screen.dark-mode .mail-header,
.phone-screen.dark-mode .mail-fields,
.phone-screen.dark-mode .status-bar,
.phone-screen.dark-mode .mail-scroll { background: #000; }
.phone-screen.dark-mode .mail-row { border-color: rgba(255, 255, 255, 0.1); }
.phone-screen.dark-mode .mail-label,
.phone-screen.dark-mode .from-email { color: #8e8e93; }
.phone-screen.dark-mode .mail-header { border-color: rgba(255, 255, 255, 0.1); }
.phone-screen.dark-mode .mail-title { color: #f2f2f7; }
.phone-screen.dark-mode .mail-body { color: #f2f2f7; }
.phone-screen.dark-mode .mail-body a { color: #0a84ff; }
.phone-screen.dark-mode .empty-preview { color: #636366; }
.phone-screen.dark-mode .home-indicator { background: rgba(255, 255, 255, 0.35); }
.phone-screen.dark-mode .compose-toolbar { background: #1c1c1e; border-color: rgba(255, 255, 255, 0.12); }
.phone-screen.dark-mode .toolbar-svg { color: #8e8e93; }
.phone-screen.dark-mode .fold-label { background: rgba(28, 28, 30, 0.95); color: #64b5f6; border-color: rgba(100, 181, 246, 0.35); }
.phone-screen.dark-mode .mail-row { border-color: rgba(255, 255, 255, 0.12); }
.phone-screen.dark-mode .mail-header { border-color: rgba(255, 255, 255, 0.12); }

/* Toast + dialog */
.save-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  animation: toastIn 0.25s var(--ease);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.shortcuts-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}
.shortcuts-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.dialog-header h2 { font-size: 17px; font-weight: 600; }
.dialog-close { font-size: 22px; line-height: 1; border: none; background: transparent; width: 32px; height: 32px; cursor: pointer; }

.shortcut-list { padding: 14px 20px; }
.shortcut-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 14px;
}
.shortcut-list dt { display: flex; gap: 4px; align-items: center; }
.shortcut-list dd { color: var(--dim); margin: 0; }

kbd {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-page);
  font-size: 11px;
  font-family: inherit;
}

.shortcut-note { padding: 0 20px 16px; font-size: 12px; color: var(--muted); }

/* Pre-flight trigger (preview toolbar) */
.preflight-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}
.preflight-trigger:hover { border-color: rgba(93, 183, 222, 0.45); color: var(--black); }
.preflight-trigger[aria-expanded="true"] { border-color: var(--sky); background: var(--sky-light); color: var(--sky-dark); }

.preflight-trigger-label { font-weight: 600; }

.preflight-score {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  font-variant-numeric: tabular-nums;
  background: #eee;
  color: var(--dim);
}
.preflight-score.pass { background: var(--pass-bg); color: var(--pass); }
.preflight-score.warn { background: var(--warn-bg); color: var(--warn); }
.preflight-score.fail { background: var(--fail-bg); color: var(--fail); }
.preflight-score.pending { background: #eee; color: var(--muted); }

/* Guided coach popups */
.coach-layer {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
}
.coach-layer:not(.hidden) { pointer-events: auto; }

.coach-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 2, 13, 0.35);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.coach-layer:not(.hidden) .coach-backdrop { opacity: 1; }

.coach-spotlight {
  position: fixed;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(7, 2, 13, 0.35);
  border: 2px solid var(--sky);
  pointer-events: none;
  transition: top 0.25s var(--ease), left 0.25s var(--ease), width 0.25s var(--ease), height 0.25s var(--ease);
  z-index: 901;
}
.coach-spotlight.hidden { display: none !important; }

.coach-popup {
  position: fixed;
  z-index: 902;
  width: min(340px, calc(100vw - 32px));
  background: var(--bg-panel);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
  padding: 16px;
  animation: coachIn 0.28s var(--ease);
}
@keyframes coachIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.coach-popup-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.coach-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.coach-popup.pass .coach-status-icon { background: var(--pass-bg); color: var(--pass); }
.coach-popup.fail .coach-status-icon { background: var(--fail-bg); color: var(--fail); }

.coach-popup-meta { flex: 1; min-width: 0; }

.coach-weight {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 2px;
}

.coach-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--black);
}

.coach-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}
.coach-close:hover { color: var(--black); }

.coach-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--dim);
  margin-bottom: 14px;
}

.coach-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.coach-progress {
  flex: 1;
  font-size: 11px;
  color: var(--muted);
  min-width: 80px;
}

.coach-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.coach-btn-primary { background: var(--sky); color: #fff; }
.coach-btn-primary:hover { background: var(--sky-dark); }
.coach-btn-secondary { background: transparent; color: var(--dim); border: 1px solid var(--border); }
.coach-btn-secondary:hover { background: #f5f5f5; color: var(--black); }

@media (max-width: 768px) {
  .app-header {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  .header-actions { flex-wrap: wrap; }
  .preview-toolbar { padding: 10px 14px; flex-wrap: wrap; }
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(320px, 45vh) minmax(380px, 55vh);
    overflow-y: auto;
    height: auto;
    min-height: calc(100vh - 120px);
  }
  html, body { overflow: auto; height: auto; min-height: 100%; }
  .editor-panel { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (prefers-reduced-motion: reduce) {
  .device-scaler { transition: none; }
  .save-toast { animation: none; }
}
