/* Application Kit — A4 pages, steps, templates, print. Preview == export. */

/* Studio fills the viewport; snap stop so you don’t scroll past in one flick */
html:has(.ak-studio) {
  --sticky-offset: 80px;
  scroll-snap-type: y mandatory;
  scroll-padding-top: var(--sticky-offset);
}

.ak-studio {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--sticky-offset));
  height: calc(100dvh - var(--sticky-offset));
  max-height: calc(100dvh - var(--sticky-offset));
  box-sizing: border-box;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
}

.ak-studio .tool-workspace.ak-workspace {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  gap: 24px;
  overflow: hidden;
}

.ak-workspace .tool-preview-area {
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

/* Inside the studio pane, sticky is unnecessary and can clip the export foot */
.ak-studio #akControls.tool-controls-sticky {
  position: relative;
  top: auto;
  max-height: none;
  overflow: hidden;
}

#akControls.tool-controls-panel,
#akControls {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  position: relative;
  z-index: 4;
}

.ak-controls-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  isolation: isolate;
}

.ak-controls-top {
  flex: 0 0 auto;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
  position: relative;
  z-index: 1;
}

.ak-controls-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px 14px;
  scrollbar-gutter: stable;
  position: relative;
  z-index: 0;
}

.ak-controls-foot {
  flex: 0 0 auto;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.92);
  position: relative;
  z-index: 8;
  overflow: visible;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

#akControls .tool-control-group {
  padding: 10px 0;
}

#akControls .tool-control-group h3 {
  margin: 0 0 8px;
  font-size: 0.84rem;
  letter-spacing: 0.01em;
}

#akControls .tool-field {
  margin-bottom: 8px;
}

#akControls .tool-field__label {
  font-size: 0.72rem;
  margin-bottom: 4px;
}

#akControls .compressor-meta,
#akControls .ak-hint {
  margin: 0 0 10px;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-light);
}

.ak-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.ak-doc-tabs,
.ak-rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.ak-stage-top {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  z-index: 3;
}

.ak-doc-tabs {
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.72);
}

.ak-doc-tab {
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  line-height: 1.2;
}

.ak-doc-tab.is-active {
  background: var(--primary);
  color: #fff;
}

.ak-doc-switch {
  margin-bottom: 12px;
}

.ak-doc-switch__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
}

.ak-doc-tabs--panel {
  width: 100%;
  margin-bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.ak-doc-tabs--panel .ak-doc-tab {
  width: 100%;
  text-align: center;
}

.ak-preview-stage {
  overflow: hidden;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  max-height: none;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  position: relative;
  padding: 10px 12px 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.12), transparent 45%),
    #0b1220;
}

.ak-preview-scale {
  width: fit-content;
  height: fit-content;
  margin: 0 auto;
  transform-origin: top center;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.ak-pager {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  margin: 0 auto 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #e2e8f0;
  font-size: 0.85rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.ak-pager[hidden] {
  display: none !important;
}

.ak-pager__btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.ak-pager__btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.25);
}

.ak-pager__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.ak-btn-remove {
  padding: 2px 8px;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.3;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  flex-shrink: 0;
}

.ak-btn-remove:hover {
  color: #fecaca;
  border-color: color-mix(in srgb, #f87171 55%, var(--border));
  background: rgba(127, 29, 29, 0.25);
}

.ak-rte-toolbar[hidden],
.tool-control-group[hidden] {
  display: none !important;
}

.ak-doc-tabs .btn.is-active,
.ak-template-card.is-active,
.ak-step.is-active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.16);
  color: #e2e8f0;
}

.ak-pages {
  position: relative;
}

/* Critical: author `display:flex` on .ak-page overrides UA [hidden] — without this,
   every page stays visible, stacks, and fitPreview shrinks the whole stack. */
.ak-pages .ak-page {
  display: none !important;
}

.ak-pages .ak-page.is-active {
  display: flex !important;
}

.ak-page[hidden] {
  display: none !important;
}

/* —— Page model: no empty print pages, preview == export —— */

.ak-page {
  width: 210mm;
  height: 297mm;
  max-height: 297mm;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--ak-text, #1f2937);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  position: relative;
  box-sizing: border-box;
}

.ak-page-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.ak-page-footer {
  flex: 0 0 auto;
  padding: 8px 14mm 10mm;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: none;
  background-image: linear-gradient(
    color-mix(in srgb, var(--ak-muted, #94a3b8) 55%, #fff),
    color-mix(in srgb, var(--ak-muted, #94a3b8) 55%, #fff)
  );
  background-size: 100% 1px;
  background-position: left top;
  background-repeat: no-repeat;
  font-size: 8.5pt;
  color: var(--ak-muted, #64748b);
  line-height: 1.3;
}

.ak-page *,
.ak-page *::before,
.ak-page *::after {
  box-sizing: border-box;
}

.ak-page img {
  max-width: 100%;
  display: block;
}

.ak-measure-host {
  position: fixed;
  left: 0;
  top: 0;
  transform: translateX(-120vw);
  opacity: 1;
  pointer-events: none;
  z-index: -1;
}

/* Off-screen host used only for print — shown in @media print */
#akPrintRoot {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 210mm;
  pointer-events: none;
  z-index: -1;
}

#akPrintRoot[hidden] {
  display: none !important;
}

.ak-letter-body[contenteditable="true"] {
  outline: 2px dashed transparent;
  min-height: 120px;
  border-radius: 4px;
  transition: outline-color 0.15s ease;
}

.ak-letter-body[contenteditable="true"]:focus {
  outline-color: color-mix(in srgb, var(--ak-accent, #72a0b0) 55%, transparent);
}

/* —— Steps —— */

.ak-step-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ak-step-bar__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ak-step-bar__count {
  font-size: 0.7rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ak-step-bar__title {
  font-size: 0.95rem;
  color: #f8fafc;
  font-weight: 650;
}

.ak-step-bar__track {
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}

.ak-step-bar__track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #67e8f9));
  border-radius: inherit;
  transition: width 0.2s ease;
}

.ak-step-bar__nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
}

.ak-step-bar__btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.45);
  color: #e2e8f0;
  cursor: pointer;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  padding: 0;
}

.ak-step-bar__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ak-step-bar__jump select {
  width: 100%;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.55);
  color: #f1f5f9;
  font: inherit;
  font-size: 0.82rem;
  padding: 0 10px;
}

.ak-subtabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 10px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid var(--border);
}

.ak-subtab {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-light);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 7px 6px;
  cursor: pointer;
}

.ak-subtab.is-active {
  background: color-mix(in srgb, var(--primary) 28%, rgba(15, 23, 42, 0.9));
  color: #fff;
}

.ak-template-rail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ak-template-chip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ak-template-chip:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

.ak-template-chip.is-active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.16);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent);
}

.ak-template-chip strong {
  font-size: 0.74rem;
  color: #f1f5f9;
  line-height: 1.2;
}

.ak-thumb {
  height: 92px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ak-thumb--sm {
  height: 48px;
}

.ak-color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ak-color-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  margin: 0;
  text-transform: capitalize;
  font-size: 0.75rem;
  color: var(--text-light);
}

.ak-color-chip input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.ak-color-chip--inline {
  padding: 4px 8px;
}

.ak-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.ak-group-head h3 {
  margin: 0 !important;
}

.ak-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
}

.ak-field-grid .tool-field {
  margin-bottom: 0;
}

.ak-export {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ak-linkish {
  border: 0;
  background: transparent;
  color: var(--text-light);
  font: inherit;
  font-size: 0.75rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
  align-self: center;
}

.ak-skill-editor-list,
.ak-inline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ak-skill-editor {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ak-skill-editor__controls {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 6px;
  align-items: center;
}

.ak-skill-style {
  font-size: 0.75rem !important;
  padding: 4px 6px !important;
  min-height: 32px;
}

.ak-skill-level {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 6px;
  align-items: center;
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-light);
}

.ak-skill-level input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.ak-inline-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}

.ak-section-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ak-section-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
}

.ak-section-row__check {
  display: flex;
  margin: 0;
}

.ak-section-title-input {
  min-width: 0;
  width: 100%;
  color: #f8fafc !important;
  background: rgba(2, 6, 23, 0.45) !important;
}

.ak-section-row .btn {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.ak-repeat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ak-repeat-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.28);
}

.ak-repeat-card--compact {
  padding: 8px 10px;
}

.ak-repeat-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.76rem;
  color: var(--text-light);
}

.ak-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.9rem;
  cursor: pointer;
}

.ak-photo-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
}

.ak-photo-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #1e293b;
}

.ak-export {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ak-download {
  position: relative;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ak-download-menu {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.ak-download-menu[hidden] {
  display: none !important;
}

.ak-download-menu button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  padding: 12px 14px;
  font: inherit;
  cursor: pointer;
}

.ak-download-menu button:hover {
  background: rgba(99, 102, 241, 0.18);
}

.ak-crop-dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  background: #0b1220;
  color: #e2e8f0;
  max-width: calc(100vw - 32px);
}

.ak-crop-dialog::backdrop {
  background: rgba(2, 6, 23, 0.72);
}

.ak-crop-dialog__inner {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ak-crop-dialog canvas {
  width: min(320px, 70vw);
  height: auto;
  border-radius: 12px;
  cursor: grab;
  touch-action: none;
  background: #111;
  align-self: center;
}

.ak-crop-dialog__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* —— Shared resume primitives —— */

.ak-cv {
  font-family: "Source Sans 3", Inter, system-ui, sans-serif;
  font-size: 10.5pt;
  line-height: 1.5;
  color: var(--ak-text);
  min-height: 0;
  height: auto;
}

.ak-page-inner > .ak-cv {
  padding: 0;
  box-sizing: border-box;
  width: 100%;
  flex: 1 1 auto;
  min-height: 100%;
}

/* Sidebar / split templates fill the page column without forcing print overflow */
.ak-page-inner > .ak-cv.ak-tpl-navy,
.ak-page-inner > .ak-cv.ak-tpl-clean,
.ak-page-inner > .ak-cv.ak-tpl-editorial,
.ak-page-inner > .ak-cv.ak-tpl-stripe,
.ak-page-inner > .ak-cv.ak-tpl-folio,
.ak-page-inner > .ak-cv.ak-tpl-cards {
  align-self: stretch;
  min-height: 100%;
}

.ak-cv h1,
.ak-cv h2,
.ak-cv h3 {
  margin: 0;
  font-weight: 700;
}

.ak-muted {
  color: var(--ak-muted);
}

.ak-accent {
  color: var(--ak-accent);
}

.ak-photo {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 8px;
  background: #e5e7eb;
  flex-shrink: 0;
}

.ak-photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 8.5pt;
  text-align: center;
  padding: 6px;
}

.ak-pad {
  padding: 16mm;
  box-sizing: border-box;
}

.ak-row-2 {
  display: grid;
  grid-template-columns: 28% 1fr;
  gap: 10px 16px;
}

.ak-section,
.ak-section-head,
.ak-entry {
  margin-top: 0;
}

.ak-section-head {
  margin-top: 26px;
  margin-bottom: 12px;
}

.ak-section-head:first-child,
.ak-flow > .ak-section-head:first-child {
  margin-top: 6px;
}

.ak-entry {
  margin-bottom: 16px;
}

.ak-section-title {
  font-size: 11.5pt;
  margin-bottom: 0;
  color: var(--ak-text);
  letter-spacing: 0.02em;
}

/* Print-safe underline (background prints; thin borders often vanish in PDF) */
.ak-section-title--rule {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10.5pt;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: none;
  background-image: linear-gradient(var(--ak-accent), var(--ak-accent));
  background-size: 100% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
}

.ak-bullets {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.ak-bullets li {
  position: relative;
  padding-left: 14px;
  margin: 5px 0;
  color: var(--ak-muted);
}

.ak-bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--ak-secondary);
  font-size: 0.75em;
  top: 0.15em;
}

/* Label above meter — full-width tracks so every bar is the same size
   (side-by-side columns collapsed in narrow sidebars and looked uneven). */
.ak-skill-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  align-items: stretch;
  margin: 9px 0;
}

.ak-skill-bar > span {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.3;
}

.ak-skill-bar--blocks,
.ak-skill-bar--dots,
.ak-skill-bar--text {
  grid-template-columns: minmax(0, 1fr);
}

.ak-skill-track {
  display: block;
  width: 100%;
  max-width: none;
  height: 8px;
  border-radius: 999px;
  /* Solid rail so empty end is always visible — fill % must not look like bar width */
  background: #d4d8de;
  border: 0;
  box-shadow: none;
  overflow: hidden;
}

.ak-skill-fill {
  display: block;
  height: 100%;
  min-width: 0;
  background: var(--ak-skill, var(--ak-primary));
  border: 0;
  box-shadow: none;
  border-radius: inherit;
}

.ak-skill-blocks {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
}

.ak-skill-blocks i {
  width: 100%;
  height: 8px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--ak-text, #111827) 16%, transparent);
  border: 0;
  box-shadow: none;
  display: block;
}

.ak-skill-blocks i.is-on {
  background: var(--ak-skill, var(--ak-primary));
  box-shadow: none;
}

.ak-skill-dots {
  display: grid;
  grid-template-columns: repeat(5, 10px);
  gap: 6px;
  align-items: center;
  justify-content: start;
  width: 100%;
}

.ak-skill-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 0;
  background: color-mix(in srgb, var(--ak-skill, var(--ak-primary)) 22%, transparent);
  display: block;
  box-sizing: border-box;
  box-shadow: none;
}

.ak-skill-dots i.is-on {
  background: var(--ak-skill, var(--ak-primary));
}

.ak-skill-level-text {
  font-style: normal;
  font-size: 0.92em;
  font-weight: 650;
  color: var(--ak-skill, var(--ak-primary));
  white-space: nowrap;
  justify-self: start;
  text-align: left;
  width: 100%;
}

/* Light sidebars keep the solid rail; dark navy needs a light rail */
.ak-side .ak-skill-track {
  background: #d4d8de;
  box-shadow: none;
}

.ak-side .ak-skill-blocks i,
.ak-side .ak-skill-dots i {
  background: #d4d8de;
  box-shadow: none;
  border: 0;
}

.ak-side .ak-skill-blocks i.is-on,
.ak-side .ak-skill-dots i.is-on,
.ak-side .ak-skill-fill {
  background: var(--ak-skill, var(--ak-accent, var(--ak-primary)));
}

.ak-side .ak-skill-level-text {
  color: var(--ak-skill, var(--ak-accent, var(--ak-primary)));
}

.ak-tpl-navy .ak-side .ak-skill-track,
.ak-tpl-navy .ak-side .ak-skill-blocks i,
.ak-tpl-navy .ak-side .ak-skill-dots i:not(.is-on) {
  background: rgba(255, 255, 255, 0.32);
}

.ak-tpl-navy .ak-side .ak-skill-level-text {
  color: color-mix(in srgb, var(--ak-skill, var(--ak-accent, #fff)) 80%, #fff);
}

.ak-timeline {
  position: relative;
  padding-left: 18px;
}

.ak-timeline-item {
  position: relative;
  padding-left: 18px;
  margin-bottom: 16px;
}

.ak-timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--ak-accent);
  background: #fff;
}

.ak-flow:has(.ak-timeline-item) {
  position: relative;
}

.ak-bar-title,
.ak-chip-bar {
  display: inline-block;
  padding: 5px 12px;
  font-size: 9pt;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.ak-bar-title {
  background: var(--ak-primary);
  color: #fff;
}

.ak-chip-bar {
  background: var(--ak-accent);
  color: #fff;
}

.ak-contact-line {
  margin-top: 8px;
  font-size: 9.5pt;
}

.ak-link {
  margin-top: 4px;
  font-size: 9.5pt;
}

.ak-continued {
  height: 0;
}

/* ============================= Classic ============================= */

.ak-tpl-classic .ak-header-band {
  background: var(--ak-secondary);
  padding: 16mm 16mm 14px;
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  align-items: center;
}

.ak-tpl-classic .ak-photo {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border: 3px solid #fff;
  border-radius: 10px;
}

.ak-tpl-classic .ak-name {
  font-size: 22pt;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ak-tpl-classic .ak-body {
  padding: 10mm 16mm 14mm;
}

.ak-tpl-classic.ak-letter .ak-letter-pad {
  padding: 16mm 16mm 14mm;
}

/* ============================== Navy ================================ */

.ak-tpl-navy {
  display: grid;
  grid-template-columns: 32% 68%;
  align-items: stretch;
}

.ak-tpl-navy .ak-side {
  background: var(--ak-primary);
  color: #fff;
  padding: 16mm 12mm;
  align-self: stretch;
}

.ak-tpl-navy .ak-side .ak-muted,
.ak-tpl-navy .ak-side .ak-bullets li {
  color: rgba(255, 255, 255, 0.82);
}

.ak-tpl-navy .ak-photo {
  width: 108px;
  height: 108px;
  margin: 0 auto 18px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.35);
}

.ak-tpl-navy .ak-main,
.ak-tpl-navy .ak-page-col {
  padding: 18mm 14mm 14mm;
  align-self: stretch;
}

.ak-tpl-navy .ak-name {
  font-size: 20pt;
  color: var(--ak-accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ak-tpl-navy .ak-summary-box {
  background: var(--ak-surface);
  padding: 14px 16px;
  border-radius: 10px;
  margin: 8px 0 14px;
  color: var(--ak-muted);
}

.ak-tpl-navy .ak-role {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 9pt;
  margin-top: 6px;
  opacity: 0.9;
}

/* ============================== Clean ================================ */

.ak-tpl-clean {
  display: grid;
  grid-template-columns: 34% 66%;
  align-items: stretch;
}

.ak-tpl-clean .ak-side {
  padding: 16mm 12mm;
  align-self: stretch;
  background: color-mix(in srgb, var(--ak-surface) 80%, #fff);
  border-right: 1px solid color-mix(in srgb, var(--ak-primary) 15%, #fff);
}

.ak-tpl-clean .ak-main,
.ak-tpl-clean .ak-page-col {
  padding: 18mm 14mm 14mm;
  align-self: stretch;
}

.ak-tpl-clean .ak-photo-wrap {
  position: relative;
  width: 108px;
  height: 108px;
  margin-bottom: 16px;
}

.ak-tpl-clean .ak-photo-wrap::before {
  content: "";
  position: absolute;
  left: -8px;
  top: -8px;
  width: 48px;
  height: 48px;
  background: var(--ak-primary);
  border-radius: 4px 0 40px 0;
}

.ak-tpl-clean .ak-photo {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
}

.ak-tpl-clean .ak-name {
  font-size: 18pt;
  color: var(--ak-primary);
  text-transform: uppercase;
}

/* ============================ Ivory Split (id: editorial) =============================== */
/* Layout follows Clean Split / Navy (sidebar + main) — warm palette, name in main */

.ak-tpl-editorial {
  display: grid;
  grid-template-columns: 34% 66%;
  align-items: stretch;
  min-height: 100%;
  background: #fffaf4;
  color: var(--ak-text);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.ak-tpl-editorial .ak-side {
  padding: 16mm 11mm;
  align-self: stretch;
  background: var(--ak-surface);
  border-right: 0;
  box-shadow: inset -1px 0 0 color-mix(in srgb, var(--ak-primary) 12%, transparent);
}

.ak-tpl-editorial .ak-main,
.ak-tpl-editorial .ak-page-col {
  padding: 16mm 14mm 14mm;
  align-self: stretch;
  background: #fffaf4;
}

.ak-tpl-editorial .ak-photo-wrap {
  width: 104px;
  height: 104px;
  margin: 0 0 14px;
  position: relative;
}

.ak-tpl-editorial .ak-photo-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 4px;
  background: var(--ak-accent);
}

.ak-tpl-editorial .ak-photo,
.ak-tpl-editorial .ak-photo--empty {
  width: 104px;
  height: 104px;
  border-radius: 6px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--ak-secondary);
  font-size: 8pt;
  color: var(--ak-muted);
  text-align: center;
  overflow: hidden;
}

.ak-tpl-editorial .ak-chip-bar {
  background: var(--ak-primary);
  color: #fffaf4;
  border-radius: 999px;
  padding: 4px 12px;
  margin: 12px 0 8px;
}

.ak-tpl-editorial .ak-side .ak-section-title,
.ak-tpl-editorial .ak-side .ak-chip-bar + .ak-section-title {
  color: var(--ak-primary);
}

.ak-tpl-editorial .ak-main-head {
  margin-bottom: 16px;
  padding-bottom: 12px;
  background-image: linear-gradient(var(--ak-secondary), var(--ak-secondary));
  background-size: 100% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
}

.ak-tpl-editorial .ak-name {
  margin: 0;
  font-size: 26pt;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 750;
  color: var(--ak-primary);
  text-transform: none;
  overflow-wrap: anywhere;
}

.ak-tpl-editorial .ak-role {
  margin-top: 6px;
  font-size: 11pt;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ak-accent);
}

.ak-tpl-editorial .ak-link {
  margin-top: 6px;
  font-size: 9.5pt;
  color: var(--ak-muted);
}

.ak-tpl-editorial .ak-main .ak-section-title {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 9.5pt;
  font-weight: 750;
  color: var(--ak-primary);
  border-bottom: none;
  padding-bottom: 7px;
  background-image: linear-gradient(var(--ak-accent), var(--ak-accent));
  background-size: 32px 2px;
  background-position: left bottom;
  background-repeat: no-repeat;
}

.ak-tpl-editorial.ak-letter .ak-letter-pad {
  padding-top: 16mm;
}

/* ============================= Compact ================================ */

.ak-tpl-compact .ak-body {
  padding: 14mm 16mm 12mm;
  box-sizing: border-box;
}

.ak-tpl-compact .ak-compact-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 8px;
}

.ak-tpl-compact .ak-name {
  font-size: 24pt;
  letter-spacing: -0.02em;
  color: var(--ak-primary);
}

.ak-tpl-compact .ak-header-line {
  height: 4px;
  width: 72px;
  background: var(--ak-accent);
  margin: 10px 0 16px;
}

.ak-tpl-compact .ak-section-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10pt;
  color: var(--ak-accent);
  border-bottom: none;
  padding-bottom: 8px;
  margin-bottom: 8px;
  background-image: linear-gradient(var(--ak-accent), var(--ak-accent));
  background-size: 100% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
}

/* ============================== Stripe ================================ */

.ak-tpl-stripe {
  position: relative;
  display: block;
  min-height: 100%;
  box-sizing: border-box;
}

.ak-tpl-stripe .ak-stripe {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  background: var(--ak-primary);
  z-index: 1;
}

.ak-tpl-stripe .ak-body {
  padding: 16mm 16mm 14mm 18mm;
  box-sizing: border-box;
  min-height: 100%;
}

.ak-tpl-stripe .ak-name {
  font-size: 22pt;
}

/* =============================== Cards ================================ */

.ak-tpl-cards .ak-body {
  min-height: 100%;
  background: var(--ak-surface);
  padding: 12mm;
  box-sizing: border-box;
}

.ak-tpl-cards .ak-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.ak-tpl-cards .ak-card--profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ak-tpl-cards .ak-name {
  font-size: 20pt;
  color: var(--ak-primary);
}

/* ============================= Timeline ================================ */

.ak-tpl-timeline .ak-body {
  padding: 14mm 16mm 12mm;
  box-sizing: border-box;
}

.ak-tpl-timeline .ak-name {
  font-size: 20pt;
  color: var(--ak-primary);
}

.ak-tpl-timeline .ak-subtitle {
  margin-top: 4px;
}

.ak-tpl-timeline .ak-timeline-grid {
  display: grid;
  grid-template-columns: 28% 1fr;
  gap: 10mm;
  margin-top: 22px;
}

.ak-tpl-timeline .ak-meta-col .ak-section-title {
  font-size: 10pt;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ak-primary);
}

.ak-tpl-timeline .ak-timeline-cont {
  display: block;
}

/* ============================= Executive =============================== */

.ak-tpl-executive .ak-pad {
  padding: 16mm 18mm 14mm;
  box-sizing: border-box;
}

.ak-tpl-executive .ak-executive-head {
  text-align: center;
  padding-bottom: 4px;
  margin-bottom: 16px;
}

.ak-tpl-executive .ak-executive-photo {
  margin: 0 auto 14px;
  width: 92px;
}

.ak-tpl-executive .ak-executive-title {
  margin-top: 6px;
  font-size: 11pt;
  letter-spacing: 0.04em;
}

.ak-tpl-executive .ak-executive-rule {
  border: 0;
  height: 1px;
  width: 64px;
  margin: 14px auto;
  background: var(--ak-accent);
}

.ak-tpl-executive .ak-name {
  font-weight: 700;
  font-size: 22pt;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ak-primary);
}

.ak-tpl-executive .ak-section-title {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10pt;
  color: var(--ak-accent);
  border-bottom: none;
  padding-bottom: 8px;
  margin-bottom: 8px;
  background-image: linear-gradient(var(--ak-accent), var(--ak-accent));
  background-size: 100% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
}

/* =============================== Folio ================================= */

.ak-tpl-folio {
  position: relative;
  display: block;
  min-height: 100%;
  box-sizing: border-box;
}

.ak-tpl-folio .ak-folio-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  background: var(--ak-accent);
  z-index: 1;
}

.ak-tpl-folio .ak-main {
  min-width: 0;
  min-height: 100%;
}

.ak-tpl-folio .ak-pad,
.ak-tpl-folio .ak-body {
  padding: 12mm 14mm 10mm 18mm;
  box-sizing: border-box;
}

.ak-tpl-folio .ak-name {
  font-weight: 800;
  font-size: 26pt;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ak-primary);
}

.ak-tpl-folio .ak-folio-role {
  font-size: 12pt;
  font-weight: 700;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ak-tpl-folio .ak-section-title {
  font-size: 12pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* —— Letter chrome —— */

.ak-letter .ak-letter-pad {
  padding-top: 14mm;
}

/* Extra air between header chrome and first address line */
.ak-letter [data-ak-chrome] + .ak-letter-pad,
.ak-letter .ak-main-head + .ak-letter-pad,
.ak-letter .ak-header-band + .ak-letter-pad,
.ak-letter .ak-main > [data-ak-chrome] + .ak-letter-pad {
  padding-top: 16mm;
}

/* Single-column letters (Compact → Folio): contact header sits closer to body —
   give clearly more room before the company address */
.ak-letter.ak-tpl-compact [data-ak-chrome] + .ak-letter-pad,
.ak-letter.ak-tpl-stripe [data-ak-chrome] + .ak-letter-pad,
.ak-letter.ak-tpl-cards [data-ak-chrome] + .ak-letter-pad,
.ak-letter.ak-tpl-timeline [data-ak-chrome] + .ak-letter-pad,
.ak-letter.ak-tpl-executive [data-ak-chrome] + .ak-letter-pad,
.ak-letter.ak-tpl-folio [data-ak-chrome] + .ak-letter-pad {
  padding-top: 22mm;
}

.ak-letter .ak-letter-meta {
  margin-bottom: 8mm;
  color: var(--ak-muted);
  font-size: 10.5pt;
  line-height: 1.55;
}

.ak-letter .ak-letter-recipient {
  margin: 0;
}

.ak-letter .ak-letter-date {
  margin-top: 6mm;
}

.ak-letter .ak-letter-subject {
  margin-top: 7mm;
  color: var(--ak-text);
  font-size: 13pt;
  font-weight: 700;
  line-height: 1.35;
}

.ak-letter .ak-letter-body {
  color: var(--ak-text);
  font-size: 11pt;
  line-height: 1.65;
}

/* Salutation above body copy — clearly smaller than subject */
.ak-letter .ak-letter-body > p:first-child {
  font-size: 11pt;
  font-weight: 600;
  margin: 0 0 1.25em;
}

.ak-letter .ak-letter-body p {
  margin: 0 0 1.2em;
}

.ak-letter .ak-letter-body p:last-child {
  margin-bottom: 0;
}

/* —— Responsive —— */

.tool-page .tool-learn {
  scroll-snap-align: start;
}

@media (max-width: 900px) {
  html:has(.ak-studio) {
    scroll-snap-type: none;
  }

  .ak-studio {
    height: auto;
    max-height: none;
    min-height: 0;
    scroll-snap-align: none;
    scroll-snap-stop: normal;
  }

  .ak-studio .tool-workspace.ak-workspace {
    align-items: start;
  }

  .ak-preview-stage {
    height: auto;
    min-height: 420px;
    overflow: auto;
  }

  .ak-template-grid {
    grid-template-columns: 1fr;
  }

  .ak-pager {
    bottom: 10px;
    max-width: calc(100% - 24px);
  }

  #akControls.tool-controls-panel,
  #akControls {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .ak-controls-shell {
    overflow: visible;
    height: auto;
    max-height: none;
  }

  .ak-controls-scroll {
    overflow-y: visible;
  }

  .ak-template-rail,
  .ak-color-grid,
  .ak-field-grid {
    grid-template-columns: 1fr;
  }

  .ak-skill-editor__controls {
    grid-template-columns: 1fr auto;
  }

  .ak-skill-style {
    grid-column: 1 / -1;
  }
}

/* —— Print helpers (iframe print is primary; keep color fidelity as fallback) —— */

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  html,
  body,
  body * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html,
  body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  body > *:not(#akPrintRoot) {
    display: none !important;
  }

  #akPrintRoot {
    display: block !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: 210mm;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff;
    pointer-events: auto !important;
    z-index: auto !important;
  }

  #akPrintRoot .ak-page,
  #akPrintRoot .ak-page.is-active,
  #akPrintRoot .ak-page[hidden] {
    display: flex !important;
    box-shadow: none !important;
    border: 0 !important;
    margin: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    overflow: hidden !important;
    page-break-after: always;
    break-after: page;
    page-break-inside: auto;
    break-inside: auto;
  }

  #akPrintRoot .ak-page:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .ak-letter-body[contenteditable="true"] {
    outline: none !important;
  }

  .ak-measure-host,
  .ak-pager {
    display: none !important;
  }
}
