/* A calm, precise workspace that keeps the signature itself in focus. */
:root {
  color-scheme: light;
  --navy: #103b58;
  --navy-deep: #092b42;
  --blue: #b8d9eb;
  --ink: #172b3b;
  --muted: #687d8e;
  --line: #dfe8ee;
  --surface: #fff;
  --bg: #f3f7fa;
  --success: #23855f;
  --accent: #17658f;
  --shadow: 0 10px 30px rgba(16, 59, 88, .055);
  --focus-ring: 0 0 0 3px rgba(45, 137, 184, .2);
  --surface-soft: #f7fafc;
  --sidebar-width: 232px;
  --scroll-thumb: #9aabb6;
  --scroll-track: #edf2f5;
  --scroll-hover: #758d9d;
}

html { min-width: 320px; scroll-behavior: smooth; scrollbar-gutter: stable; }
/* All app-owned scroll regions inherit the same baseline; iframe documents stay independent. */
* { scrollbar-color: var(--scroll-thumb) var(--scroll-track); scrollbar-width: thin; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: var(--scroll-track); }
*::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border: 2px solid var(--scroll-track); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover, *::-webkit-scrollbar-thumb:active { background: var(--scroll-hover); }
body { font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.ui-icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [contenteditable="true"]:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}
.app-shell { min-height: 100svh; }
.sidebar {
  width: var(--sidebar-width); min-width: var(--sidebar-width); flex: 0 0 var(--sidebar-width);
  height: 100svh; padding: 32px 16px 20px; background: var(--navy-deep); box-shadow: none;
}
.brand-lockup { padding: 0 12px 28px; }
.brand-lockup img { width: 176px; }
.brand-lockup span { font-size: 11px; letter-spacing: .12em; }
.nav { gap: 6px; min-height: 0; overflow-y: auto; padding-bottom: 16px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 12px; border-radius: 9px; font-weight: 550; transition: background-color .16s ease, color .16s ease, box-shadow .16s ease; }
.nav-item .ui-icon { width: 18px; height: 18px; opacity: .8; }
.nav-item:hover { background: rgba(184, 217, 235, .11); }
.nav-item.active { background: rgba(184, 217, 235, .17); box-shadow: inset 3px 0 #b8d9eb; }
.sidebar-footer { min-width: 0; flex: none; font-size: 11px; letter-spacing: .01em; padding: 18px 12px 0; border-top: 1px solid rgba(184,217,235,.14); }
.main-content { width: min(100%, 1600px); max-width: 1600px; min-width: 0; padding: 36px clamp(24px, 3vw, 48px) 24px; }
.topbar { position: relative; align-items: center; gap: 24px; margin-bottom: 28px; }
.eyebrow { font-size: 11px; letter-spacing: .12em; margin-bottom: 8px; }
.topbar h1 { font-size: clamp(27px, 3vw, 34px); letter-spacing: -.04em; font-weight: 650; }
.page-subtitle { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.account-chip { flex: none; min-height: 54px; max-width: 340px; padding: 8px 13px 8px 9px; border-radius: 10px; box-shadow: none; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.account-chip > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.account-chip:hover { border-color: #c9dce7; box-shadow: 0 8px 22px rgba(14, 59, 89, .08); transform: translateY(-1px); }
.account-chip strong { font-size: 13px; letter-spacing: -.01em; }
.account-chip small { font-size: 11px; }
.workspace-grid, .left-column, .right-column { gap: 20px; }
.card { padding: clamp(20px, 2.2vw, 30px); border-radius: 14px; box-shadow: 0 2px 4px rgba(16,59,88,.025); transition: border-color .18s ease; }
.card-heading { align-items: center; margin-bottom: 19px; }
.card-heading h2 { font-size: 17px; font-weight: 650; letter-spacing: -.025em; }
.card-heading p { font-size: 12px; line-height: 1.45; }
.step { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-soft); border: 1px solid var(--line); font-size: 11px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.ghost-button, .editor-tab {
  min-height: 36px;
  padding: 8px 12px;
  border-color: #c9dce7;
  border-radius: 8px;
  font-size: 12px;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.ghost-button:hover, .editor-tab:hover { background: #f2f8fb; border-color: #9fc5da; }
.ghost-button:active, .editor-tab:active, .primary-button:active:not(:disabled) { transform: translateY(1px); }
.dropzone {
  position: relative;
  min-height: 104px;
  flex-direction: row;
  justify-content: flex-start;
  padding: 20px 24px;
  border-width: 1px;
  border-color: #b8d2e0;
  border-radius: 11px;
  gap: 16px;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.dropzone input { display: block; position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.upload-copy { display: grid; gap: 4px; }
.dropzone:hover, .dropzone:focus-within { border-color: #5c9fc1; background: #f5fbfe; box-shadow: inset 0 0 0 1px rgba(23, 101, 143, .08); }
.dropzone strong { font-size: 13px; }
.dropzone span:not(.upload-icon) { font-size: 11px; }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); flex: none; }
.upload-icon .ui-icon { width: 22px; height: 22px; }
.template-meta { min-height: 29px; font-size: 11px; }
.template-meta span:first-child { max-width: calc(100% - 72px); overflow-wrap: anywhere; }
.template-input-modes, .editor-mode-tabs { gap: 7px; }
.editor-tab { background: #fff; }
.editor-tab.active { background: #eaf5fa; border-color: #91c4dc; color: #104f73; box-shadow: inset 0 0 0 1px rgba(23, 101, 143, .04); }
.editor-workspace { border-radius: 10px; padding: 11px; }
.visual-editor, textarea, .domain-select, .user-search { border-color: #d8e4eb; border-radius: 9px; }
.visual-editor { min-height: 160px; padding: 16px; line-height: 1.6; }
textarea { font-size: 12px; line-height: 1.55; background: #fbfcfd; }
textarea:focus, .visual-editor:focus { border-color: #77b1cf; box-shadow: var(--focus-ring); outline: 0; }
.editor-label-row { margin-top: 14px; }
.field-label { font-size: 12px; color: #425a6b; }
.variables-card { min-height: 0; padding-top: 20px; padding-bottom: 20px; }
.variables-card .card-heading { margin-bottom: 12px; }
.variable-chip { padding: 7px 10px; border-radius: 7px; font-size: 11px; }
.empty-state { font-size: 12px; }
.preview-card { padding-bottom: 20px; }
.live-pill { padding: 5px 8px; border-radius: 999px; background: #eff8f3; font-size: 10px; letter-spacing: .01em; }
.live-pill i { width: 6px; height: 6px; }

/* Keep email markup at intrinsic dimensions; those dimensions are the product preview. */
.template-card > .preview-frame {
  border-color: #dce6ec;
  border-radius: 10px;
  background: #f5f8fa;
  scrollbar-color: #9aabb6 #edf2f5;
  scrollbar-width: thin;
}
.template-card > .preview-frame::-webkit-scrollbar, .user-scope #userList::-webkit-scrollbar { width: 9px; height: 9px; }
.template-card > .preview-frame::-webkit-scrollbar-thumb, .user-scope #userList::-webkit-scrollbar-thumb { background: #aebbc4; border: 2px solid #f4f7f9; border-radius: 99px; }
.template-card > .preview-frame::-webkit-scrollbar-track, .user-scope #userList::-webkit-scrollbar-track { background: #f1f5f7; }
.template-card > .preview-frame .preview-render { min-width: 0 !important; }
.template-card > .preview-frame:has(.preview-placeholder) { width: 100%; min-height: 160px; }
.template-card .preview-placeholder { width: 100%; min-height: 160px; align-content: center; gap: 8px; }
/* The artboard owns the design mode; importing and the rendered preview remain available in Prévia. */
.template-card:has(.signature-designer[data-active="true"]) > .dropzone { display: none; }
.signature-designer { container-type: inline-size; margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); padding: 20px; }
.signature-designer[hidden] { display: none; }
.html-visual-wrap { justify-content: safe center; min-height: 560px; }
.html-visual-frame { flex: 0 0 auto; display: block; min-width: 0; max-width: none; min-height: 280px; border: 0; background: #fff; box-shadow: 0 5px 18px #1c3c501a; }
.html-visual-link-tools, .html-visual-image-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0; color: var(--muted); font-size: 12px; }
.html-visual-link-tools input, .html-visual-image-tools input { min-height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: var(--surface); color: var(--ink); font: inherit; }
.html-visual-link-tools input { flex: 1 1 230px; }
.html-visual-image-tools input { width: 90px; }
.html-visual-link-tools input:focus-visible, .html-visual-image-tools input:focus-visible { outline: 3px solid #8bbcd5; outline-offset: 2px; }
.signature-toolbar #designSignatureButton { margin-left: auto; }
.designer-image-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.designer-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.designer-intro h3 { margin: 0 0 3px; color: var(--ink); font-size: 15px; letter-spacing: -.02em; }
.designer-intro p { margin: 0; color: var(--muted); font-size: 12px; }
.designer-dimensions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.designer-dimensions label { display: flex; align-items: center; gap: 6px; color: #425a6b; font-size: 11px; font-weight: 650; }
.designer-dimensions input { width: 82px; min-height: 34px; border: 1px solid #cbdde8; border-radius: 7px; padding: 5px 7px; color: var(--ink); font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.2; }
.designer-dimensions input:focus-visible { outline: 3px solid #8bbcd5; outline-offset: 2px; }
.designer-size-hint { margin: 0 0 9px; color: var(--muted); font-size: 11px; }
.designer-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(215px, .38fr); align-items: start; gap: 18px; }
.designer-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.designer-fieldset { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; display: grid; gap: 6px; }
.designer-fieldset legend { padding: 0 5px; color: #36536a; font-size: 11px; font-weight: 700; }
.designer-fieldset > label { margin-top: 3px; color: #425a6b; font-size: 11px; font-weight: 600; }
.designer-optional { color: var(--muted); font-weight: 400; }
.designer-fieldset input:not([type="color"]), .designer-fieldset select { width: 100%; min-width: 0; min-height: 36px; border: 1px solid #d8e4eb; border-radius: 7px; background: #fff; color: var(--ink); padding: 7px 9px; font-size: 12px; }
.designer-fieldset small, .designer-tokens > small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.designer-style-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.designer-style-grid > label { display: grid; align-content: start; gap: 5px; color: #425a6b; font-size: 10px; font-weight: 600; }
.designer-style-grid input[type="color"] { width: 100%; height: 35px; border: 1px solid #d8e4eb; border-radius: 7px; background: #fff; padding: 3px; cursor: pointer; }
.designer-style-grid-even { grid-template-columns: minmax(0, 1fr) 112px; }
.designer-style-grid-even > label:first-child { grid-column: 1 / -1; }
.designer-tokens { grid-column: 1 / -1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; display: grid; gap: 8px; }
.designer-tokens > strong { font-size: 11px; color: var(--ink); }
.designer-tokens > div { display: flex; flex-wrap: wrap; gap: 6px; }
.designer-tokens button { min-height: 30px; padding: 5px 9px; border: 1px solid #d5e5ed; border-radius: 7px; background: #f7fbfd; color: #245774; font-size: 10px; cursor: pointer; }
.designer-tokens button:hover { background: #eaf5fa; border-color: #9fc5da; }
.designer-guidance { border-left: 2px solid #c7e0ec; padding: 7px 0 7px 15px; color: #50697a; font-size: 11px; line-height: 1.55; }
.designer-guidance strong { color: var(--ink); font-size: 12px; }
.designer-guidance ol { display: grid; gap: 8px; margin: 10px 0; padding-left: 18px; }
.designer-guidance p { margin: 10px 0 0; }
.designer-error { grid-column: 1 / -1; margin: 0; border-radius: 7px; padding: 9px 11px; background: #fff3f1; color: #9b3028; font-size: 11px; }
.designer-error[hidden] { display: none; }
.canvas-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 10px 0 14px; border-bottom: 1px solid var(--line); }
.canvas-toolbar button, .inspector-token-tools button { min-height: 34px; padding: 6px 11px; border: 1px solid #cbdde8; border-radius: 7px; background: #fff; color: #164c6a; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.2; cursor: pointer; transition: background-color .14s ease, border-color .14s ease, transform .14s ease; }
.canvas-toolbar button:hover, .inspector-token-tools button:hover { background: #edf6fa; border-color: #8bb7cf; }
.canvas-toolbar button:active { transform: translateY(1px); }
.canvas-toolbar button:disabled { cursor: not-allowed; opacity: .52; transform: none; }
.canvas-toolbar .canvas-undo-button { margin-left: auto; }
.canvas-toolbar button:focus-visible, .inspector-token-tools button:focus-visible, .canvas-drag-handle:focus-visible, .inspector-action:focus-visible { outline: 3px solid #8bbcd5; outline-offset: 2px; }
.canvas-toolbar-note { width: 100%; margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.designer-format-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px; margin: 14px 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.format-group { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.format-group + .format-group { padding-left: 12px; border-left: 1px solid var(--line); }
.format-group.format-fields { width: 100%; padding: 10px 0 0; border: 0; border-top: 1px solid var(--line); }
.format-fields button { background: var(--surface-soft); font-weight: 500; }
.designer-format-toolbar button, .designer-format-toolbar select, .format-color { min-height: 32px; border: 1px solid #d1dfe7; border-radius: 6px; background: #fff; color: #24465b; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.2; }
.designer-format-toolbar button { min-width: 34px; padding: 5px 8px; cursor: pointer; }
.designer-format-toolbar button:hover:not(:disabled), .designer-format-toolbar button.is-active { border-color: #79afce; background: #eaf5fa; color: #104d6e; }
.designer-format-toolbar button:disabled { color: #9aaab4; background: #f2f5f7; cursor: not-allowed; }
.designer-format-toolbar select { padding: 5px 7px; }
.format-toolbar-label, .format-token-label { color: #536b7a; font-size: 10px; font-weight: 650; }
.format-toolbar-separator { width: 1px; height: 22px; margin: 0 3px; background: #d7e2e9; }
.format-color { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; min-width: 34px; font-size: 15px; font-weight: 750; }
.format-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.designer-format-toolbar button:focus-visible, .designer-format-toolbar select:focus-visible, .format-color:focus-within { outline: 3px solid #8bbcd5; outline-offset: 2px; }
.canvas-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; padding-top: 5px; }
.signature-canvas-wrap { display: flex; align-items: flex-start; justify-content: safe center; min-width: 0; min-height: 560px; overflow: auto; padding: 32px; border: 1px solid var(--line); border-radius: 8px; background-color: #eaf0f4; background-image: radial-gradient(#cbd7df 0.7px, transparent 0.7px); background-size: 16px 16px; }
.signature-canvas { flex: 0 0 auto; width: 600px; min-height: 280px; margin: 0 auto; padding: 0; background: #fff; box-shadow: 0 5px 18px #1c3c501a; color: #263746; }
.canvas-empty { min-height: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: #62798a; }
.canvas-empty > span { width: 38px; height: 38px; display: grid; place-items: center; border: 1px dashed #8bb7cf; border-radius: 50%; color: #17658f; font-size: 24px; }
.canvas-empty strong { color: #314c60; font-size: 14px; }
.canvas-empty small { font-size: 12px; }
.canvas-object { position: relative; display: flex; align-items: stretch; width: 100%; box-sizing: border-box; cursor: pointer; }
.canvas-object:hover { background: #f8fbfd; }
.canvas-object.is-selected { outline: 1px solid #75afd0; outline-offset: -1px; background: #f6fbfe; box-shadow: inset 3px 0 #17658f; }
.canvas-object:focus-visible { outline: 2px solid #17658f; outline-offset: -2px; }
.canvas-object-select { display: flex; flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: inherit; cursor: pointer; }
.canvas-object-select:focus-visible { outline: 2px solid #17658f; outline-offset: -2px; }
.canvas-object-art { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 4px 8px; white-space: pre-wrap; }
.canvas-object-text .canvas-object-art { min-height: 28px; outline: none; cursor: text; }
.canvas-object-text .canvas-object-art[data-placeholder="true"] { color: #8193a0 !important; }
.canvas-object-text .canvas-object-art:focus { background: #fff; box-shadow: inset 0 -1px #9ac4da; }
.canvas-object-image .canvas-object-art, .canvas-object-divider .canvas-object-art { display: flex; align-items: center; }
.canvas-object-image img { display: block; object-fit: contain; }
.canvas-object-divider .canvas-object-art { padding: 6px 8px; }
.canvas-object-spacer .canvas-object-art { padding: 0; }
.canvas-object-columns .canvas-object-art { padding: 0; }
.canvas-columns-art { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.canvas-columns-art > div { min-width: 0; overflow-wrap: anywhere; padding: 6px 8px; }
.canvas-drag-handle { position: absolute; z-index: 1; top: 50%; left: 2px; width: 20px; height: 24px; transform: translateY(-50%); border: 0; border-radius: 4px; background: transparent; color: #708696; font-size: 17px; cursor: grab; opacity: .65; }
.canvas-drag-handle:hover { background: #e8f2f7; opacity: 1; }
.canvas-object:hover .canvas-drag-handle, .canvas-object.is-selected .canvas-drag-handle { opacity: 1; }
.canvas-resize-handle { position: absolute; right: 1px; bottom: 1px; width: 24px; height: 24px; border: 1px solid #75afd0; border-radius: 5px; background: #fff; color: #14597d; font-size: 14px; cursor: nwse-resize; touch-action: none; box-shadow: 0 1px 4px #092b4226; }
.canvas-resize-handle:focus-visible { outline: 3px solid #8bbcd5; outline-offset: 2px; }
.canvas-inspector { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
@container (min-width: 1100px) { .canvas-workspace { grid-template-columns: minmax(0, 1fr) 250px; } }
.inspector-empty { color: var(--muted); font-size: 12px; line-height: 1.5; }
.inspector-empty > strong { color: var(--ink); font-size: 13px; }
.inspector-empty p { margin: 6px 0 14px; }
.canvas-token-tools, .inspector-token-tools { display: grid; gap: 8px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.canvas-token-tools > strong, .inspector-token-tools > strong { color: #36536a; font-size: 11px; }
.canvas-token-tools > div, .inspector-token-tools > div { display: flex; flex-wrap: wrap; gap: 5px; }
.canvas-token-tools button, .inspector-token-tools button { min-height: 28px; padding: 4px 7px; font-size: 10px; }
.inspector-selected[hidden] { display: none; }
.inspector-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-size: 13px; }
.inspector-heading span { color: var(--muted); font-size: 10px; }
.inspector-actions { display: flex; flex-wrap: wrap; gap: 5px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.inspector-action { min-height: 30px; padding: 5px 7px; border: 1px solid #d9e5ec; border-radius: 6px; background: #fff; color: #31546b; font-size: 10px; font-weight: 600; cursor: pointer; }
.inspector-action:hover:not(:disabled) { border-color: #a7c6d9; background: #f3f9fc; }
.inspector-action:disabled { color: #91a1ac; background: #f5f7f8; cursor: not-allowed; }
.inspector-fields { display: grid; gap: 10px; padding-top: 12px; }
.inspector-field { display: grid; gap: 5px; color: #425a6b; font-size: 10px; font-weight: 650; }
.inspector-field input:not([type="color"]):not([type="range"]), .inspector-field select, .inspector-textarea { width: 100%; min-width: 0; min-height: 32px; border: 1px solid #d8e4eb; border-radius: 6px; background: #fff; color: var(--ink); padding: 6px 8px; font-family: inherit; font-size: 12px; line-height: 1.4; }
.inspector-field input[type="color"] { width: 100%; height: 34px; border: 1px solid #d8e4eb; border-radius: 6px; background: #fff; padding: 3px; }
.inspector-textarea { min-height: 75px; resize: none; }
.inspector-field .inspector-range { width: 100%; accent-color: #17658f; }
.inspector-check { display: flex; align-items: center; gap: 7px; color: #425a6b; font-size: 11px; cursor: pointer; }
.designer-footnote { margin: 11px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.designer-error { margin-top: 10px; }
.designer-error.is-pending { border: 1px solid #c6dfed; background: #eef7fb; color: #285c79; }
@media (max-width: 920px) { .canvas-inspector { min-height: 120px; } .canvas-toolbar-note { width: 100%; margin: 2px 0 0; } }
@media (max-width: 620px) { .designer-intro { flex-direction: column; } .designer-dimensions { justify-content: flex-start; } .signature-canvas-wrap { min-height: 460px; justify-content: flex-start; padding: 12px; } .canvas-toolbar { gap: 6px; } .canvas-toolbar button { min-height: 38px; } }
@media (prefers-reduced-motion: reduce) { .canvas-toolbar button { transition: none; } }
.result-dialog .confirm-cancel { min-height: 42px; margin: 10px 0 0 8px; padding: 10px 14px; border: 1px solid #c9dce7; border-radius: 8px; background: #fff; color: #14597d; font-size: 12px; font-weight: 650; cursor: pointer; }
.result-dialog .confirm-cancel:hover { background: #f2f8fb; }
.preview-placeholder { min-height: 220px; padding: 24px; }
.preview-placeholder span { font-size: 32px; color: #83b6d0; }
.preview-placeholder strong { font-size: 13px; color: #42596a; }
.preview-placeholder small { font-size: 11px; }
.preview-user { gap: 11px; padding-top: 15px; font-size: 12px; }
.preview-user strong { font-size: 12px; }
.preview-user small { font-size: 11px; }
.avatar { width: 35px; height: 35px; font-size: 11px; }
.avatar.large { width: 38px; height: 38px; }
.scope-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.scope-option {
  position: relative;
  min-height: 63px;
  gap: 11px;
  padding: 12px 13px;
  border-radius: 10px;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.scope-option:hover { border-color: #bfd7e4; background: #fbfdfe; }
.scope-option.selected { border-color: #82bad5; background: #f5fbfe; box-shadow: inset 0 0 0 1px rgba(23, 101, 143, .04); }
.scope-option:focus-within { box-shadow: var(--focus-ring); }
.scope-option input { display: block; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.scope-option.disabled input { cursor: not-allowed; }
.scope-option strong { font-size: 12px; }
.scope-option small { font-size: 11px; line-height: 1.4; }
.radio { width: 17px; height: 17px; }
.scope-option.selected .radio:after { width: 7px; height: 7px; left: 3.5px; top: 3.5px; }
.recommended { font-size: 9px; letter-spacing: .01em; padding: 5px 8px; }
.domain-select, .user-search { min-height: 42px; padding: 9px 12px; color: var(--ink); font-size: 12px; background-color: #fff; }
.domain-select { margin-top: 10px; }
.user-search { font: inherit; font-size: 13px; }
.user-search-wrap { position: relative; margin: 12px 0; }
.user-search-wrap .user-search { margin: 0; padding-right: 42px; }
.user-search-clear { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.user-search-clear:hover { background: var(--surface-soft); color: var(--ink); }
.user-search-clear[hidden], .user-scope #userList label[hidden] { display: none; }
.user-search-empty { margin: 12px 0; color: var(--muted); font-size: 12px; }
.user-search-empty[hidden] { display: none; }
.domain-select:disabled { background: var(--surface-soft); color: var(--muted); cursor: not-allowed; opacity: .7; }
.user-scope { padding: 13px; border-color: #e1e9ee; border-radius: 10px; background: #fcfdfe; }
.user-scope #userList { max-height: 190px; gap: 2px; padding-right: 4px; }
.user-scope #userList label { min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; transition: background-color .15s ease; }
.user-scope #userList label:hover { background: #f0f6f9; color: var(--ink); }
.user-scope input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); flex: none; }
.user-scope > label { display: flex; align-items: center; gap: 8px; min-height: 34px; cursor: pointer; }
.user-scope > label input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.user-scope small { font-size: 11px; }
.primary-button {
  min-height: 46px;
  padding: 13px 16px;
  border-radius: 9px;
  font-size: 13px;
  letter-spacing: -.005em;
  transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease, opacity .16s ease;
}
.primary-button:hover:not(:disabled) { background: #0b496c; box-shadow: 0 7px 16px rgba(14, 59, 89, .15); }
.primary-button:disabled { opacity: .48; }
.apply-card > .primary-button { max-width: 300px; margin-left: auto; }
.app-legal-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 24px; font-size: 11px; }
.footer-brand { color: var(--muted); }
.footer-brand > span { padding: 0 7px; color: var(--line); }
.footer-links { display: inline-flex; gap: 8px; }
.app-legal-footer a { transition: color .15s ease; }
.toast { border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; padding: 12px 16px; font-size: 12px; }
.login-gate { min-height: min(72vh, 760px); }
.auth-loading { position: fixed; inset: 0 0 0 var(--sidebar-width); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(243, 247, 250, .94); }
.auth-loading[hidden] { display: none; }
.auth-loading-card { display: flex; align-items: center; gap: 18px; width: min(100%, 420px); min-height: 98px; padding: 22px 25px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.auth-loading-card strong { display: block; color: var(--ink); font-size: 15px; font-weight: 650; }
.auth-loading-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.auth-loading-spinner { flex: none; width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: auth-spin .8s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.login-gate-card { border-radius: 17px; padding: clamp(28px, 5vw, 46px); box-shadow: 0 18px 50px rgba(14, 59, 89, .08); }
.login-gate-card h1 { letter-spacing: -.035em; }
.login-gate-card p { font-size: 14px; }
.account-menu { top: calc(100% + 8px); right: 0; min-width: 160px; border-radius: 10px; padding: 5px; }
.account-menu button { width: 100%; text-align: left; }
.account-menu button { min-height: 38px; font-size: 12px; }
.help-panel { margin-top: 0; line-height: 1.65; }
.help-content { max-width: 88ch; margin-left: 46px; }
.help-content h3 { color: var(--navy); font-size: 15px; letter-spacing: -.015em; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.help-content h3:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.help-content p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.help-content strong { color: var(--ink); font-weight: 600; }
.help-content pre { overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-soft); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.tenant-admin-form { max-width: 780px; }
.signature-image-status, .history-warning { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); background: var(--surface-soft); font-size: 12px; }
.signature-image-status[hidden] { display: none; }
.signature-image-status.is-error, .history-warning { color: #9b3028; background: #fff3f1; }
.history-status { min-height: 24px; color: var(--muted); font-size: 13px; }
.template-history-list { display: grid; gap: 10px; }
.template-history-list[aria-busy="true"] { opacity: .65; pointer-events: none; }
.template-history-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.history-entry-info { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.history-entry-info strong { font-size: 14px; font-weight: 600; }
.history-entry-info small { color: var(--muted); font-size: 12px; }
.history-entry-actions { display: flex; flex-wrap: wrap; flex: none; gap: 8px; }
.template-history-preview { padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.template-history-preview[hidden] { display: none; }
.template-history-preview h3 { font-size: 15px; }
.history-preview-viewport { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.history-preview-frame { display: block; height: 360px; border: 0; max-width: none; }
.tenant-row button { min-height: 36px; padding: 6px 10px; border-radius: 6px; }
.tenant-row button:hover { background: #fde8e8; }
.tenant-row { border: 1px solid #e7edf1; border-radius: 9px; }
.editor-modal { padding: clamp(12px, 3vw, 28px); }
.editor-modal-dialog { border: 1px solid #dfe8ee; border-radius: 15px; }
.editor-modal-header { min-height: 60px; padding: 13px 18px; }
.editor-modal-body { padding: clamp(12px, 2.5vw, 22px); }
::selection { color: #0a334d; background: #c9e6f3; }
.signature-toolbar { flex-wrap: wrap; gap: 6px; padding: 6px; margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.signature-toolbar .editor-tab { border-color: transparent; background: transparent; color: var(--muted); font-weight: 600; }
.signature-toolbar .editor-tab:hover { background: var(--surface); color: var(--accent); }
.signature-toolbar .editor-tab.active { border-color: var(--line); background: var(--surface); color: var(--navy); box-shadow: 0 1px 3px rgba(16,59,88,.05); }
.signature-toolbar .ghost-button { background: var(--surface); }

@media (max-width: 1000px) {
  .sidebar { width: 220px; min-width: 220px; flex-basis: 220px; }
  .auth-loading { left: 220px; }
  .main-content { padding: 30px 26px 24px; }
  .workspace-grid, .right-column { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 700px) {
  .auth-loading { inset: 64px 0 0; align-items: flex-start; padding-top: min(24vh, 160px); }
  .app-shell { display: block; }
  .sidebar { position: relative; top: auto; width: 100%; min-width: 0; min-height: 0; height: auto; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0; padding: 15px 18px 12px; box-shadow: 0 5px 20px rgba(8, 43, 67, .09); }
  .brand-lockup { width: 100%; padding: 0; border: 0; }
  .brand-lockup img { width: 152px; }
  .brand-lockup span { display: none; }
  /* Override the legacy modal stylesheet's desktop navigation layout on phones. */
  .nav { width: 100%; display: flex !important; gap: 6px; overflow-x: auto; padding: 12px 0 4px; }
  .nav-item { flex: none; min-height: 39px; padding: 9px 12px; font-size: 12px; white-space: nowrap; }
  .nav-item.active { box-shadow: inset 0 -2px #b8d9eb; }
  .sidebar-footer { width: 100%; min-width: 0; justify-content: flex-start; margin: 9px 0 0; padding: 8px 0 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 10px; }
  .main-content { width: 100%; padding: 24px 16px 22px; }
  .topbar { align-items: center; flex-direction: row; gap: 12px; margin-bottom: 21px; }
  .topbar h1 { font-size: 26px; }
  .eyebrow { font-size: 9px; letter-spacing: .1em; }
  .account-chip { width: auto; min-width: 0; max-width: 48%; gap: 7px; padding: 7px; border-radius: 11px; font-size: 11px; }
  .account-chip > span:nth-child(2) { min-width: 0; overflow: hidden; }
  .account-chip strong, .account-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-chip small { max-width: 150px; font-size: 9px; }
  .account-chip .avatar { width: 30px; height: 30px; flex: none; }
  .chevron { display: none; }
  .card { padding: 18px; border-radius: 13px; }
  .card-heading { gap: 9px; margin-bottom: 16px; }
  .card-heading > div:first-child { gap: 10px; }
  .card-heading h2 { font-size: 15px; }
  .card-heading p { font-size: 11px; }
  .step { width: 29px; height: 29px; flex: none; }
  .card-heading > .ghost-button { max-width: 43%; white-space: normal; line-height: 1.25; }
  .dropzone { min-height: 100px; padding: 16px; gap: 12px; }
  .template-card > .preview-frame { max-width: 100%; }
  .signature-toolbar { flex-wrap: wrap; gap: 6px; }
  .signature-toolbar .ghost-button { margin-left: 0; }
  .signature-toolbar .editor-tab { flex: 1 1 auto; }
  .designer-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .designer-guidance { border-left: 0; border-top: 1px solid var(--line); padding: 12px 0 0; }
  .designer-controls { grid-template-columns: minmax(0, 1fr); }
  .designer-tokens { grid-column: auto; }
  .designer-intro { flex-direction: column; gap: 8px; }
  .designer-dimensions { justify-content: flex-start; }
  .signature-designer { padding: 14px; }
  .format-group + .format-group { padding-left: 0; border-left: 0; }
  .template-input-modes { flex-wrap: wrap; }
  .scope-option { padding: 11px; gap: 9px; }
  .scope-options { grid-template-columns: minmax(0, 1fr); }
  .apply-card > .primary-button { max-width: none; }
  .help-content { margin-left: 0; }
  .template-history-row { align-items: flex-start; flex-direction: column; }
  .tenant-admin-form { align-items: stretch; flex-direction: column; }
  .recommended { max-width: 85px; text-align: center; white-space: normal; }
  .editor-modal { padding: 8px; }
  .editor-modal-dialog { width: 100%; height: calc(100svh - 16px); border-radius: 12px; }
  .editor-modal-header { padding: 12px 14px; }
  .editor-modal-body { padding: 10px; }
  .toast { right: 12px; bottom: 12px; left: 12px; text-align: center; }
  .app-legal-footer { padding-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { .auth-loading-spinner { animation-duration: 2s; } }
@media (forced-colors: active) {
  * { scrollbar-color: auto; }
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid Highlight; }
}
@media (max-width: 420px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .account-chip { width: 100%; max-width: none; }
  .account-chip small { max-width: none; }
  .card-heading > .ghost-button { max-width: 46%; font-size: 10px; padding: 7px 8px; }
  .scope-option { align-items: flex-start; }
  .radio { margin-top: 2px; }
  .recommended { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
