/* ============================================================================
   CV Studio — glassmorphic design system
   ----------------------------------------------------------------------------
   Two worlds live in this file, deliberately:
     1. THE CHROME  — dark, translucent, blurred glass. Everything the author
                      touches: gate, topbar, editor rail, toolbars, sheets.
     2. THE PAPER   — an opaque light A4 document (.cv-page). It is what gets
                      printed and rendered to PDF, so it never inherits glass,
                      never inherits the dark theme, and stays ink-on-white.
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */

:root {
  /* Driven at runtime from the active profile / design panel. */
  --accent: #4338ca;
  --accent-rgb: 67, 56, 202;

  --bg: #06070d;
  --bg-2: #0b0d18;

  --ink: #eaedf7;
  --ink-2: #aab2cb;
  --ink-3: #7b849f;
  --ink-4: #59617a;

  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.085);
  --glass-3: rgba(255, 255, 255, 0.125);
  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-2: rgba(255, 255, 255, 0.16);
  --hairline-3: rgba(255, 255, 255, 0.26);

  --tint: rgba(var(--accent-rgb), 0.16);
  --tint-2: rgba(var(--accent-rgb), 0.3);
  --tint-glow: rgba(var(--accent-rgb), 0.45);

  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;

  --blur: 20px;
  --blur-lg: 34px;

  --r-xs: 9px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --sh-2: 0 12px 32px -12px rgba(0, 0, 0, 0.65);
  --sh-3: 0 34px 90px -34px rgba(0, 0, 0, 0.9);
  --sh-glow: 0 0 0 1px var(--tint-2), 0 18px 50px -20px var(--tint-glow);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 0.16s;
  --mid: 0.28s;
  --slow: 0.5s;

  --sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --rail: 452px;
  --topbar-h: 68px;
}

/* ------------------------------------------------------------------- reset */

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

* {
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

ul,
ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.9);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection {
  background: rgba(var(--accent-rgb), 0.4);
  color: #fff;
}

/* scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-pill);
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.26);
  background-clip: content-box;
}

/* -------------------------------------------------------------- background */

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(
      120% 80% at 12% -10%,
      rgba(var(--accent-rgb), 0.3),
      transparent 60%
    ),
    radial-gradient(90% 70% at 100% 0%, rgba(56, 189, 248, 0.14), transparent 55%),
    radial-gradient(
      100% 90% at 50% 120%,
      rgba(168, 85, 247, 0.16),
      transparent 60%
    ),
    linear-gradient(180deg, var(--bg-2), var(--bg) 60%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.orb-a {
  width: 44vw;
  height: 44vw;
  top: -12vw;
  left: -8vw;
  background: rgba(var(--accent-rgb), 0.55);
  animation: drift-a 26s var(--ease) infinite alternate;
}
.orb-b {
  width: 36vw;
  height: 36vw;
  top: 30vh;
  right: -10vw;
  background: rgba(56, 189, 248, 0.4);
  animation: drift-b 32s var(--ease) infinite alternate;
}
.orb-c {
  width: 40vw;
  height: 40vw;
  bottom: -16vw;
  left: 34vw;
  background: rgba(217, 70, 239, 0.32);
  animation: drift-c 38s var(--ease) infinite alternate;
}

.grain {
  position: absolute;
  inset: -50%;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes drift-a {
  to {
    transform: translate3d(8vw, 10vh, 0) scale(1.15);
  }
}
@keyframes drift-b {
  to {
    transform: translate3d(-10vw, -8vh, 0) scale(1.2);
  }
}
@keyframes drift-c {
  to {
    transform: translate3d(6vw, -12vh, 0) scale(1.1);
  }
}

/* ------------------------------------------------------------ glass recipe */

.glass {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--hairline);
  box-shadow:
    var(--sh-2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Top sheen — the tell that a surface is glass, not just translucent. */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0) 34%
  );
}

@supports not (backdrop-filter: blur(1px)) {
  .glass {
    background: rgba(16, 18, 30, 0.92);
  }
}

/* -------------------------------------------------------------- primitives */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  /* min-height, not height: a fixed height slices the label as soon as it
     wraps or the user scales text up. Same resting size, no clipping. */
  min-height: 38px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline-2);
  background: var(--glass-2);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 560;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    background var(--fast) var(--ease),
    border-color var(--fast) var(--ease),
    transform var(--fast) var(--ease),
    box-shadow var(--mid) var(--ease);
}
.button:hover {
  background: var(--glass-3);
  border-color: var(--hairline-3);
}
.button:active {
  transform: translateY(1px) scale(0.99);
}
.button.ghost {
  background: transparent;
  border-color: var(--hairline);
  color: var(--ink-2);
}
.button.ghost:hover {
  background: var(--glass);
  color: var(--ink);
  border-color: var(--hairline-2);
}
.button.primary {
  background: linear-gradient(
    180deg,
    rgba(var(--accent-rgb), 0.95),
    rgba(var(--accent-rgb), 0.78)
  );
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow:
    var(--sh-1),
    0 12px 30px -14px var(--tint-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.button.primary:hover {
  filter: brightness(1.08);
  box-shadow:
    var(--sh-1),
    0 16px 40px -14px var(--tint-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.button.danger-ghost {
  background: transparent;
  border-color: rgba(251, 113, 133, 0.35);
  color: var(--bad);
}
.button.danger-ghost:hover {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.55);
}
.button:disabled,
.icon-button:disabled {
  opacity: 0.34;
  pointer-events: none;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  color: var(--ink-2);
  font-size: 15px;
  /* Symbol glyphs (↶ ⟲ ◷) overshoot a line-height of exactly 1. */
  line-height: 1.1;
  transition:
    background var(--fast) var(--ease),
    color var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
}
.icon-button:hover {
  background: var(--glass-2);
  border-color: var(--hairline);
  color: var(--ink);
}

.button-group {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
}
.button-group .icon-button {
  width: 32px;
  height: 30px;
  border-radius: var(--r-xs);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline-2);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 560;
  letter-spacing: 0.02em;
  transition: all var(--fast) var(--ease);
}
.pill:hover {
  color: var(--ink);
  border-color: var(--hairline-3);
  background: var(--glass-2);
}
.pill[aria-pressed="true"] {
  color: #fff;
  background: rgba(var(--accent-rgb), 0.28);
  border-color: rgba(var(--accent-rgb), 0.6);
}

.text-button {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 560;
  padding: 4px 2px;
  border-radius: var(--r-xs);
  transition: color var(--fast) var(--ease);
}
.text-button:hover {
  color: var(--bad);
}

.grow {
  flex: 1;
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 680;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(var(--accent-rgb), 1);
  filter: brightness(1.6) saturate(0.9);
}

/* form fields */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.field > span,
.field > legend {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 620;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.field > span em,
.field > legend em {
  font-style: normal;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-4);
}
.swatch-field {
  border: 0;
}

input[type="text"],
input:not([type]),
input[type="email"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  font-size: 14px;
  transition:
    border-color var(--fast) var(--ease),
    background var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}
textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.55;
}
input::placeholder,
textarea::placeholder {
  color: var(--ink-4);
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--hairline-2);
}
input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: rgba(var(--accent-rgb), 0.75);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}
select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(
      45deg,
      transparent 50%,
      var(--ink-3) 50%,
      var(--ink-3) 58%,
      transparent 58%
    ),
    linear-gradient(
      -45deg,
      transparent 50%,
      var(--ink-3) 50%,
      var(--ink-3) 58%,
      transparent 58%
    );
  background-size:
    8px 8px,
    8px 8px;
  background-position:
    right 17px center,
    right 12px center;
  background-repeat: no-repeat;
}
select option {
  background: #12141f;
  color: var(--ink);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.colour-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
input[type="color"] {
  width: 46px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 3px;
}
input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 8px;
}
.colour-value {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease);
}
.switch-row:hover {
  border-color: var(--hairline-2);
}
.switch-row > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.switch-row b {
  font-size: 13.5px;
  font-weight: 600;
}
.switch-row small {
  font-size: 12px;
  color: var(--ink-3);
}
.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-row i {
  position: relative;
  flex: none;
  width: 42px;
  height: 25px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--hairline-2);
  transition: all var(--mid) var(--ease);
}
.switch-row i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--sh-1);
  transition: transform var(--mid) var(--ease-out);
}
.switch-row input:checked + i {
  background: rgba(var(--accent-rgb), 0.9);
  border-color: rgba(var(--accent-rgb), 1);
  box-shadow: 0 0 18px -4px var(--tint-glow);
}
.switch-row input:checked + i::after {
  transform: translateX(17px);
}
.switch-row input:focus-visible + i {
  outline: 2px solid rgba(var(--accent-rgb), 0.9);
  outline-offset: 2px;
}

/* ================================================================== GATE == */

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  overflow: auto;
  opacity: 0;
  transition:
    opacity var(--slow) var(--ease),
    visibility var(--slow);
  visibility: hidden;
}
body[data-view="gate"] .gate {
  opacity: 1;
  visibility: visible;
}
body[data-view="loading"] .gate,
body[data-view="studio"] .gate {
  pointer-events: none;
}

.gate-inner {
  width: 100%;
  max-width: 1040px;
  text-align: center;
  transform: translateY(14px) scale(0.985);
  transition: transform var(--slow) var(--ease-out);
}
body[data-view="gate"] .gate-inner {
  transform: none;
}

.gate-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 11px;
  margin-bottom: 26px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline-2);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.spark {
  color: rgba(var(--accent-rgb), 1);
  filter: brightness(1.7);
}

.gate-title {
  font-size: clamp(34px, 6vw, 60px);
  font-weight: 700;
  letter-spacing: -0.035em;
  /* background-clip:text paints the gradient into the LINE BOX, not the glyph
     outlines, so a line-height below the font's own ascent+descent slices the
     letters — descenders ("g", "y") go first. 1.02 was clipping "Sign in" at
     every clamp size. 1.16 clears the descender at the largest size, and the
     padding absorbs the overhang some faces draw beyond their declared metrics. */
  line-height: 1.16;
  padding-block-end: 0.06em;
  background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0.62));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Gradient text has no real colour, so a forced-colours or print context
     would render it invisible. Restore a solid fill in both. */
  @media (forced-colors: active), print {
    background: none;
    color: CanvasText;
  }
}
.gate-sub {
  margin: 14px auto 0;
  max-width: 46ch;
  font-size: 15px;
  color: var(--ink-3);
}

.tile-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin: 46px 0 34px;
}

.tile {
  position: relative;
  width: 172px;
  padding: 18px 14px 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(170%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  box-shadow:
    var(--sh-2),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  transition:
    transform var(--mid) var(--ease-out),
    border-color var(--mid) var(--ease),
    box-shadow var(--mid) var(--ease),
    background var(--mid) var(--ease);
  animation: tile-in var(--slow) var(--ease-out) both;
}
.tile:nth-child(1) {
  animation-delay: 0.02s;
}
.tile:nth-child(2) {
  animation-delay: 0.06s;
}
.tile:nth-child(3) {
  animation-delay: 0.1s;
}
.tile:nth-child(4) {
  animation-delay: 0.14s;
}
.tile:nth-child(n + 5) {
  animation-delay: 0.18s;
}

@keyframes tile-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-6px);
  border-color: var(--tile-ring, var(--hairline-3));
  background: var(--glass-2);
  box-shadow:
    var(--sh-3),
    0 0 0 1px var(--tile-ring, transparent),
    0 22px 60px -26px var(--tile-glow, transparent);
}
.tile:focus-visible {
  outline: none;
}

.tile-avatar {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 26px;
  font-size: 30px;
  font-weight: 640;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--tile-fill, linear-gradient(150deg, #6366f1, #312e81));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -14px 26px -14px rgba(0, 0, 0, 0.55),
    0 14px 34px -14px var(--tile-glow, rgba(0, 0, 0, 0.6));
  transition: transform var(--mid) var(--ease-out);
}
.tile:hover .tile-avatar {
  transform: scale(1.04);
}

.tile-name {
  font-size: 14.5px;
  font-weight: 620;
  line-height: 1.25;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.tile-role {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.tile-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(var(--accent-rgb), 0.85);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

/* add-profile tile */
.tile.add {
  border-style: dashed;
  border-color: var(--hairline-2);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink-2);
}
.tile.add:hover {
  border-color: rgba(var(--accent-rgb), 0.7);
  color: var(--ink);
}
.tile.add .tile-avatar {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--hairline-3);
  box-shadow: none;
  font-size: 38px;
  font-weight: 300;
  color: var(--ink-2);
}
.tile.add:hover .tile-avatar {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.6);
  color: #fff;
}

/* manage mode */
.tile-edit {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: rgba(6, 7, 13, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  font-size: 26px;
  color: #fff;
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
}
body.managing .tile:not(.add) .tile-edit {
  opacity: 1;
}
body.managing .tile:not(.add) {
  cursor: pointer;
}

.gate-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.gate-count {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* ================================================================= SHEET == */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 5, 10, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in var(--mid) var(--ease) both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.sheet {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  animation: sheet-in var(--mid) var(--ease-out) both;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sheet-head h2 {
  font-size: 19px;
  font-weight: 640;
  letter-spacing: -0.02em;
}
.sheet-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.swatch {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    var(--sh-1);
  transition:
    transform var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}
.swatch:hover {
  transform: translateY(-2px) scale(1.06);
}
.swatch[aria-checked="true"] {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 2px var(--bg),
    0 0 0 4px currentColor;
}

/* ================================================================ TOPBAR == */

.app {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  opacity: 0;
  transition: opacity var(--slow) var(--ease);
}
body[data-view="studio"] .app {
  opacity: 1;
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 16px;
  margin: 12px 12px 0;
  border-radius: var(--r-lg);
  z-index: 20;
}

.who {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 12px 5px 5px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  min-width: 0;
  transition:
    background var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
}
.who:hover {
  background: var(--glass-2);
  border-color: var(--hairline);
}
.who-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 640;
  color: #fff;
  background: var(--tile-fill, linear-gradient(150deg, #6366f1, #312e81));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.who-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.25;
}
.who-copy strong {
  font-size: 13.5px;
  font-weight: 620;
  max-width: 32ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.who-copy small {
  font-size: 11px;
  color: var(--ink-3);
  max-width: 32ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.who-chevron {
  font-style: normal;
  color: var(--ink-4);
  font-size: 12px;
}

.pane-switch {
  display: none;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
}
.pane-switch button {
  padding: 7px 16px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 580;
  color: var(--ink-3);
  transition: all var(--fast) var(--ease);
}
.pane-switch button.active {
  color: #fff;
  background: rgba(var(--accent-rgb), 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
}

.save-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 10px;
  height: 32px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  font-size: 11.5px;
  font-weight: 540;
  color: var(--ink-3);
  white-space: nowrap;
}
.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px currentColor;
  transition: background var(--mid) var(--ease);
}

.more-button {
  display: none;
}

.menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 12px;
  min-width: 214px;
  padding: 7px;
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  display: flex;
  flex-direction: column;
  animation: sheet-in var(--fast) var(--ease-out) both;
}
.menu button {
  padding: 10px 12px;
  border-radius: var(--r-xs);
  text-align: left;
  font-size: 13.5px;
  color: var(--ink-2);
  transition:
    background var(--fast) var(--ease),
    color var(--fast) var(--ease);
}
.menu button:hover {
  background: var(--glass-2);
  color: var(--ink);
}
.menu button.danger-text {
  color: var(--bad);
}

/* save-failure banner */
.save-error {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 12px 0;
  padding: 11px 16px;
  border-radius: var(--r-md);
  border: 1px solid rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.13);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 13px;
  color: #ffe4e6;
}
.save-error button {
  flex: none;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  font-size: 12.5px;
  font-weight: 580;
  color: #fff;
}
.save-error button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ================================================================== SHELL == */

.app-shell {
  flex: 1;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

/* ============================================================ EDITOR RAIL == */

.editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.editor::after {
  z-index: 0;
}
.editor > * {
  position: relative;
  z-index: 1;
}

.editor-heading {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 20px 16px;
}
.editor-heading h1 {
  margin-top: 5px;
  font-size: 21px;
  font-weight: 660;
  letter-spacing: -0.028em;
}

.score {
  position: relative;
  flex: none;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  --score: 0%;
}
.score-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(
      rgba(var(--accent-rgb), 1) var(--score),
      rgba(255, 255, 255, 0.08) 0
    );
  mask: radial-gradient(farthest-side, transparent 68%, #000 70%);
  -webkit-mask: radial-gradient(farthest-side, transparent 68%, #000 70%);
  transition: background var(--slow) var(--ease);
  filter: drop-shadow(0 0 8px var(--tint-glow));
}
.score-copy {
  display: flex;
  align-items: baseline;
  gap: 1px;
}
.score-copy strong {
  font-size: 17px;
  font-weight: 660;
  letter-spacing: -0.03em;
}
.score-copy small {
  font-size: 9.5px;
  color: var(--ink-3);
}

.tabs {
  flex: none;
  display: flex;
  gap: 3px;
  margin: 0 20px;
  padding: 3px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--hairline);
}
.tab {
  flex: 1;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 580;
  color: var(--ink-3);
  transition: all var(--fast) var(--ease);
}
.tab:hover {
  color: var(--ink-2);
}
.tab.active {
  color: #fff;
  background: rgba(var(--accent-rgb), 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 6px 18px -10px var(--tint-glow);
}

.panel {
  flex: 1;
  min-height: 0;
  overflow: hidden auto;
  overscroll-behavior: contain;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* section jump chips */
.section-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.section-jump button {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11.5px;
  font-weight: 560;
  color: var(--ink-3);
  transition: all var(--fast) var(--ease);
}
.section-jump button:hover {
  color: var(--ink);
  border-color: rgba(var(--accent-rgb), 0.6);
  background: rgba(var(--accent-rgb), 0.14);
}

/* collapsible control cards */
.control-card {
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.032);
  overflow: hidden;
  transition:
    border-color var(--mid) var(--ease),
    background var(--mid) var(--ease);
}
.control-card:hover {
  border-color: var(--hairline-2);
}
.control-card.open {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--hairline-2);
}

.card-title {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  text-align: left;
}
.card-title > span {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.card-title > span > span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.card-title b {
  font-size: 13.5px;
  font-weight: 620;
}
.card-title small {
  font-size: 11.5px;
  color: var(--ink-3);
}
.static-title {
  cursor: default;
}

.card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  font-size: 13px;
  font-style: normal;
  color: rgba(var(--accent-rgb), 1);
  filter: brightness(1.5);
  background: rgba(var(--accent-rgb), 0.16);
  border: 1px solid rgba(var(--accent-rgb), 0.28);
}

.chevron {
  font-style: normal;
  font-size: 13px;
  color: var(--ink-4);
  transition: transform var(--mid) var(--ease);
}
.control-card.open .chevron {
  transform: rotate(180deg);
}

.card-body {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 0 15px 15px;
}
.control-card.open .card-body,
.static-controls {
  display: flex;
}

/* repeatable items */
.repeat-item {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.035);
}
.repeat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.repeat-head strong {
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink-2);
  /* Was overflow:hidden + ellipsis, which cut company and school names in the
     editor. Wrapping costs a line and shows the whole value. */
  overflow-wrap: anywhere;
  min-width: 0;
  white-space: normal;
}
.item-actions {
  display: flex;
  gap: 3px;
  flex: none;
}
.mini-button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.045);
  font-size: 11px;
  color: var(--ink-3);
  transition: all var(--fast) var(--ease);
}
.mini-button:hover {
  color: var(--ink);
  border-color: var(--hairline-3);
  background: var(--glass-2);
}
.mini-button.danger:hover {
  color: var(--bad);
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.14);
}
.mini-button:disabled {
  opacity: 0.28;
  pointer-events: none;
}

.add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--hairline-2);
  background: transparent;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--ink-2);
  transition: all var(--fast) var(--ease);
}
.add-button:hover {
  color: #fff;
  border-color: rgba(var(--accent-rgb), 0.7);
  background: rgba(var(--accent-rgb), 0.14);
}

/* review tab */
.review-hero {
  display: flex;
  gap: 14px;
  padding: 17px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  background: linear-gradient(
    150deg,
    rgba(var(--accent-rgb), 0.2),
    rgba(var(--accent-rgb), 0.05)
  );
}
.review-hero > span {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-xs);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.review-hero h2 {
  margin: 4px 0 5px;
  font-size: 16px;
  font-weight: 640;
  letter-spacing: -0.02em;
}
.review-hero p {
  font-size: 12.5px;
  color: var(--ink-2);
}

.review-item {
  display: flex;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.035);
  font-size: 13px;
  color: var(--ink-2);
}
.review-item.done {
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.08);
}
.review-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  color: var(--warn);
  background: rgba(251, 191, 36, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.34);
}
.review-item.done .review-icon {
  color: var(--ok);
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.36);
}

.editor-footer {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.02);
  font-size: 11.5px;
  color: var(--ink-3);
}
.editor-footer > span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.editor-footer > span > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-footer i {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px currentColor;
}

/* storage state colours */
body[data-storage="checking"] .save-dot,
body[data-storage="checking"] .editor-footer i,
body[data-storage="saving"] .save-dot,
body[data-storage="saving"] .editor-footer i {
  background: var(--warn);
  animation: pulse 1.3s var(--ease) infinite;
}
body[data-storage="browser"] .save-dot,
body[data-storage="browser"] .editor-footer i {
  background: #60a5fa;
}
body[data-storage="error"] .save-dot,
body[data-storage="error"] .editor-footer i {
  background: var(--bad);
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

/* ============================================================== WORKSPACE == */

.workspace {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 12px;
}
.workspace:focus-visible {
  outline-offset: -2px;
}

.workspace-toolbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 14px;
  border-radius: var(--r-md);
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--ink-2);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px currentColor;
  animation: pulse 2.4s var(--ease) infinite;
}
.preview-title b {
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hairline);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 11px;
}
.zoom-controls button {
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11.5px;
  font-weight: 580;
  color: var(--ink-3);
  transition: all var(--fast) var(--ease);
}
.zoom-controls button:hover {
  color: var(--ink);
  border-color: var(--hairline-2);
}
.zoom-controls button.active {
  color: #fff;
  background: rgba(var(--accent-rgb), 0.3);
  border-color: rgba(var(--accent-rgb), 0.55);
}
.zoom-controls output {
  min-width: 42px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: right;
}

input[type="range"] {
  width: 116px;
  height: 22px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.14);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow:
    var(--sh-1),
    0 0 0 4px rgba(var(--accent-rgb), 0.24);
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.14);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.24);
}

.paper-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  justify-content: center;
  padding: 26px 30px 60px;
}
.paper-frame {
  position: relative;
  flex: none;
  border-radius: 3px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 40px 90px -40px rgba(0, 0, 0, 0.9),
    0 10px 30px -12px rgba(0, 0, 0, 0.7);
}

/* ================================================== THE PAPER (light world) */

.cv-page {
  --paper: #ffffff;
  --paper-ink: #16181d;
  --paper-ink-2: #4a5160;
  --paper-ink-3: #767e8e;
  --paper-rule: #e3e7ee;
  --paper-tint: rgba(var(--accent-rgb), 0.07);
  --gap: 20px;
  --body: 10.6px;

  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  width: 794px;
  min-height: 1123px;
  padding: 46px 52px 52px;
  background: var(--paper);
  color: var(--paper-ink);
  font-family: var(--sans);
  font-size: var(--body);
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
}

.cv-page.font-classic {
  font-family: var(--serif);
}
.cv-page.font-clean {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.cv-page.density-compact {
  --gap: 16px;
  --body: 10.2px;
  line-height: 1.44;
}
.cv-page.density-comfortable {
  --gap: 21px;
  --body: 11px;
}
.cv-page.density-spacious {
  --gap: 27px;
  --body: 11.6px;
  line-height: 1.6;
}

/* header */
.cv-header {
  padding-bottom: calc(var(--gap) * 0.8);
  border-bottom: 2px solid rgba(var(--accent-rgb), 1);
  margin-bottom: var(--gap);
}
.cv-name {
  font-size: 2.72em;
  font-weight: 700;
  letter-spacing: -0.028em;
  /* 1.02 crowded and clipped descenders on the printed page — a name with a
     "y" or "j" lost its tail. Tall enough for the glyphs at every density. */
  line-height: 1.14;
  color: var(--paper-ink);
}
.cv-page.font-classic .cv-name {
  font-weight: 600;
  letter-spacing: -0.012em;
}
.cv-title {
  margin-top: 0.45em;
  font-size: 1.16em;
  font-weight: 550;
  color: rgba(var(--accent-rgb), 1);
  letter-spacing: -0.005em;
}
.cv-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 16px;
  margin-top: 0.9em;
  font-size: 0.94em;
  color: var(--paper-ink-2);
}
.cv-contact a {
  color: inherit;
  text-decoration: none;
}
.cv-contact > * {
  position: relative;
}
.cv-contact > * + *::before {
  content: "";
  position: absolute;
  left: -8.5px;
  top: 50%;
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 50%;
  background: var(--paper-ink-3);
}

/* body grid */
.cv-body {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  gap: calc(var(--gap) * 1.5);
  align-items: start;
}
.cv-primary {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}
.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

.cv-section,
.sidebar-panel {
  break-inside: avoid;
}

.cv-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: calc(var(--gap) * 0.6);
  font-size: 0.87em;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(var(--accent-rgb), 1);
}
.cv-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--paper-rule);
}

.cv-profile {
  color: var(--paper-ink-2);
  text-align: justify;
  hyphens: auto;
}

/* experience timeline */
.timeline-item {
  position: relative;
  padding-left: 15px;
  padding-bottom: calc(var(--gap) * 0.85);
  break-inside: avoid;
}
.timeline-item:last-child {
  padding-bottom: 0;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 1);
}
.timeline-item::after {
  content: "";
  position: absolute;
  left: 2.5px;
  top: calc(0.42em + 10px);
  bottom: 4px;
  width: 1px;
  background: var(--paper-rule);
}
.timeline-item:last-child::after {
  display: none;
}

.job-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px 14px;
  margin-bottom: 0.3em;
}
.job-role {
  font-size: 1.12em;
  font-weight: 640;
  letter-spacing: -0.012em;
  color: var(--paper-ink);
}
.job-company {
  font-weight: 560;
  color: var(--paper-ink-2);
}
.job-date {
  flex: none;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--paper-tint);
  font-size: 0.84em;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(var(--accent-rgb), 1);
  white-space: nowrap;
}

.job-list {
  display: flex;
  flex-direction: column;
  gap: 0.34em;
  margin-top: 0.5em;
  color: var(--paper-ink-2);
}
.job-list li {
  position: relative;
  padding-left: 12px;
}
.job-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.56em;
  width: 4px;
  height: 1.5px;
  border-radius: 1px;
  background: rgba(var(--accent-rgb), 0.75);
}

/* sidebar blocks */
.sidebar-panel {
  padding: 13px 14px;
  border-radius: 8px;
  background: #f7f8fb;
  border: 1px solid var(--paper-rule);
}

.edu-item {
  padding-bottom: 0.65em;
  margin-bottom: 0.65em;
  border-bottom: 1px solid var(--paper-rule);
}
.edu-item:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}
.edu-item strong {
  display: block;
  font-size: 1.02em;
  font-weight: 640;
  color: var(--paper-ink);
}
.edu-item span {
  display: block;
  margin-top: 0.15em;
  color: var(--paper-ink-2);
}
.edu-date {
  display: block;
  margin-top: 0.25em;
  font-size: 0.86em;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--paper-ink-3);
}

.skill-block + .skill-block {
  margin-top: 0.8em;
}
.skill-block strong {
  display: block;
  margin-bottom: 0.4em;
  font-size: 0.95em;
  font-weight: 640;
  color: var(--paper-ink);
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.skill-tag {
  padding: 2.5px 8px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--paper-rule);
  font-size: 0.88em;
  color: var(--paper-ink-2);
}

.language-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0.28em 0;
}
.language-item + .language-item {
  border-top: 1px solid var(--paper-rule);
}
.language-item strong {
  font-weight: 600;
  color: var(--paper-ink);
}
.language-item span {
  font-size: 0.88em;
  color: var(--paper-ink-3);
}

/* references */
.reference-grid {
  display: flex;
  flex-direction: column;
  gap: 0.7em;
}
.reference-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.reference-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 1);
  color: #fff;
  font-size: 0.86em;
  font-weight: 640;
}
.reference-details {
  min-width: 0;
}
.reference-item strong {
  display: block;
  font-weight: 640;
  color: var(--paper-ink);
}
.reference-role,
.reference-org {
  display: block;
  color: var(--paper-ink-2);
}
.reference-contact {
  display: block;
  margin-top: 0.2em;
  font-size: 0.88em;
  color: var(--paper-ink-3);
  overflow-wrap: anywhere;
}

/* ---- ATS layout: one column, no decoration, machine-readable ------------- */

.cv-page.layout-ats {
  padding: 42px 54px;
}
.cv-page.layout-ats .cv-header {
  border-bottom: 1px solid #cfd4dd;
  text-align: left;
}
.cv-page.layout-ats .cv-title {
  color: var(--paper-ink-2);
  font-weight: 560;
}
.cv-page.layout-ats .cv-body {
  display: block;
}
.cv-page.layout-ats .sidebar-column {
  display: block;
  margin-top: var(--gap);
}
.cv-page.layout-ats .sidebar-panel {
  padding: 0;
  background: none;
  border: 0;
  margin-bottom: var(--gap);
}
.cv-page.layout-ats .cv-section-title {
  color: var(--paper-ink);
  letter-spacing: 0.08em;
}
.cv-page.layout-ats .cv-section-title::after {
  display: none;
}
.cv-page.layout-ats .timeline-item {
  padding-left: 0;
}
.cv-page.layout-ats .timeline-item::before,
.cv-page.layout-ats .timeline-item::after {
  display: none;
}
.cv-page.layout-ats .job-date {
  background: none;
  padding: 0;
  color: var(--paper-ink-2);
}
.cv-page.layout-ats .job-list li::before {
  content: "•";
  position: static;
  width: auto;
  height: auto;
  background: none;
  margin-right: 5px;
  color: var(--paper-ink-2);
}
.cv-page.layout-ats .job-list li {
  padding-left: 0;
}
.cv-page.layout-ats .skill-tag {
  border: 0;
  padding: 0;
  background: none;
}
.cv-page.layout-ats .skill-tags {
  gap: 0;
}
.cv-page.layout-ats .skill-tag + .skill-tag::before {
  content: "· ";
  color: var(--paper-ink-3);
}
.cv-page.layout-ats .reference-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7em 20px;
}
.cv-page.layout-ats .reference-avatar {
  display: none;
}
.cv-page.layout-ats .cv-profile {
  text-align: left;
}

/* ================================================================== TOAST == */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 80;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  box-shadow: var(--sh-3);
  font-size: 13.5px;
  font-weight: 540;
  color: var(--ink);
  transform: translate(-50%, 22px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--mid) var(--ease),
    transform var(--mid) var(--ease-out);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============================================================ PDF RENDERING */

/* The headless render loads the same page: strip the chrome, unscale the
   paper, and let the server measure #cvPreview at its true size. */
body.pdf-render {
  overflow: visible;
  background: #fff;
}
body.pdf-render .aurora,
body.pdf-render .gate,
body.pdf-render .scrim,
body.pdf-render .topbar,
body.pdf-render .save-error,
body.pdf-render .editor,
body.pdf-render .workspace-toolbar,
body.pdf-render .toast {
  display: none !important;
}
body.pdf-render .app {
  display: block !important;
  opacity: 1 !important;
  height: auto;
}
body.pdf-render .app-shell {
  display: block;
  padding: 0;
  gap: 0;
}
body.pdf-render .workspace {
  display: block;
  gap: 0;
}
body.pdf-render .paper-stage {
  display: block;
  overflow: visible;
  padding: 0;
}
body.pdf-render .paper-frame {
  position: static;
  width: 794px !important;
  height: auto !important;
  border-radius: 0;
  box-shadow: none;
}
body.pdf-render .cv-page {
  position: static;
  transform: none !important;
  box-shadow: none;
}

/* =============================================================== RESPONSIVE */

@media (max-width: 1180px) {
  :root {
    --rail: 392px;
  }
  .cv-page {
    /* keep A4 geometry; the JS scales it to fit */
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .pane-switch {
    display: flex;
  }
  .editor,
  .workspace {
    display: none;
  }
  body:not(.show-preview) .editor {
    display: flex;
  }
  body.show-preview .workspace {
    display: flex;
  }
  .hide-sm {
    display: none;
  }
  .more-button {
    display: inline-grid;
  }
  .save-state span:last-child {
    display: none;
  }
  .save-state {
    padding: 0 9px;
  }
}

@media (max-width: 680px) {
  .topbar {
    height: auto;
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 10px;
    margin: 8px 8px 0;
  }
  .pane-switch {
    order: 3;
    width: 100%;
  }
  .pane-switch button {
    flex: 1;
  }
  .topbar-actions {
    gap: 7px;
  }
  .app-shell {
    padding: 8px;
    gap: 8px;
  }
  .editor-heading {
    padding: 16px 15px 12px;
  }
  .editor-heading h1 {
    font-size: 18px;
  }
  .tabs {
    margin: 0 15px;
  }
  .panel {
    padding: 13px 15px 16px;
  }
  .editor-footer {
    padding: 10px 15px;
  }
  .paper-stage {
    padding: 12px 12px 40px;
  }
  .tile {
    width: 138px;
    padding: 14px 10px 16px;
  }
  .tile-avatar {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    font-size: 25px;
  }
  .tile-grid {
    gap: 14px;
    margin: 32px 0 26px;
  }
  .zoom-controls input[type="range"] {
    display: none;
  }
}

/* ==================================================================== PRINT */

@media print {
  .aurora,
  .gate,
  .scrim,
  .topbar,
  .save-error,
  .editor,
  .workspace-toolbar,
  .toast {
    display: none !important;
  }
  body {
    background: #fff;
    overflow: visible;
  }
  .app {
    display: block !important;
    opacity: 1 !important;
    height: auto;
  }
  .app-shell,
  .workspace,
  .paper-stage {
    display: block;
    padding: 0;
    gap: 0;
    overflow: visible;
  }
  .paper-frame {
    position: static;
    width: auto !important;
    height: auto !important;
    box-shadow: none;
  }
  .cv-page {
    position: static;
    transform: none !important;
    width: 100%;
    min-height: 0;
    padding: 14mm 15mm;
  }
  @page {
    size: A4;
    margin: 0;
  }
}

/* ========================================================= REDUCED MOTION  */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .orb {
    animation: none;
  }
}
