.app-shell {
  min-height: calc(100vh - 72px);
  background: linear-gradient(180deg, #fbfaf8 0, #ffffff 58%);
}

.page-hero {
  padding: 46px 0 28px;
}

.page-hero-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  padding-bottom: 58px;
}

.template-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(17, 24, 39, 0.07);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.05);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  animation: cardIn 520ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.template-card:nth-child(2) {
  animation-delay: 120ms;
}

.template-card:nth-child(3) {
  animation-delay: 240ms;
}

.template-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.11);
}

.template-card.is-favorite {
  border-color: rgba(255, 107, 44, 0.34);
  box-shadow: 0 16px 38px rgba(255, 107, 44, 0.12), 0 0 0 1px rgba(255, 107, 44, 0.1);
}

.template-preview-wrap {
  position: relative;
  overflow: hidden;
  background: #f6f7f9;
}

.template-favorite-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 183, 92, 0.44);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #9a431b;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.12);
  font-size: 0.78rem;
  font-weight: 900;
  backdrop-filter: blur(12px);
}

.template-favorite-badge .ui-icon,
.template-category .ui-icon {
  width: 15px;
  height: 15px;
  fill: #ffb15f;
  stroke: #9a431b;
}

.template-card img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  object-position: top;
  background: #f6f7f9;
}

.template-live-preview {
  height: 420px;
  overflow: hidden;
  background: #f6f7f9;
}

.template-live-preview .resume-canvas {
  transform: scale(0.36);
  transform-origin: top left;
  box-shadow: none;
}

.template-body {
  display: grid;
  gap: 7px;
  min-height: 124px;
  padding: 14px 16px 16px;
}

.template-body h2,
.panel h2,
.generated-card h3 {
  margin: 0;
}

.panel h2,
.upload-card h2 {
  margin: 0 0 8px;
  font-size: 1.18rem;
}

.template-body h2 {
  font-size: 1.05rem;
}

.template-body p,
.panel p,
.generated-card p {
  color: var(--nimo-muted);
}

.template-body p {
  margin: 0;
  font-size: 0.9rem;
}

.template-category {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #94a3b8 !important;
  font-size: 0.78rem !important;
  font-weight: 700;
  text-transform: capitalize;
}

.template-actions {
  position: absolute;
  inset: auto 12px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.template-card:hover .template-actions,
.template-card:focus-within .template-actions {
  opacity: 1;
  transform: translateY(0);
}

.editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: calc(100vh - 72px);
  background: #f7f6f3;
}

.canvas-workspace {
  min-width: 0;
  padding: 18px;
}

.side-dock {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow: auto;
  border-left: 1px solid var(--nimo-line);
  background: #ffffff;
  padding: 10px 18px 18px;
}

.mobile-sheet-close,
.mobile-editor-rail {
  display: none;
}

.panel {
  margin-bottom: 14px;
  padding: 16px;
}

.tool-strip {
  position: sticky;
  top: 72px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-bottom: 14px;
  padding: 9px 10px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.07);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--nimo-line);
  border-radius: 12px;
  background: white;
  color: var(--nimo-ink);
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.92rem;
  outline: none;
}

.field textarea {
  padding-top: 12px;
  padding-bottom: 12px;
}

.tool-input {
  width: 66px;
  height: 38px;
  border: 1px solid var(--nimo-line);
  border-radius: 10px;
  background: white;
  color: var(--nimo-ink);
  padding: 0 10px;
  outline: none;
}

.tool-select {
  width: auto;
  min-width: 108px;
  height: 38px;
  border: 1px solid var(--nimo-line);
  border-radius: 10px;
  background: white;
  color: var(--nimo-ink);
  padding: 0 10px;
  outline: none;
}

.tool-color {
  width: 40px;
  height: 38px;
  padding: 4px;
  border: 1px solid var(--nimo-line);
  border-radius: 10px;
  background: white;
}

.toolbar-section {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-right: 1px solid #ece7df;
}

.toolbar-section:last-child {
  border-right: 0;
}

.toolbar-label {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 700;
}

.selection-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

.tool-icon {
  position: relative;
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: var(--nimo-charcoal);
}

.tool-icon .ui-icon {
  width: 19px;
  height: 19px;
}

.tool-button.is-active {
  border-color: rgba(255, 107, 44, 0.5);
  background: #fff0e5;
  color: var(--nimo-orange-dark);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 44, 0.18);
}

.segmented-icon-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--nimo-line);
  border-radius: 12px;
  background: #ffffff;
}

.segmented-icon-group .tool-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span,
.field label {
  color: var(--nimo-muted);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.field textarea {
  min-height: 130px;
  resize: vertical;
}

[data-adapt-prompt] {
  min-height: 82px !important;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.tool-input:focus,
.tool-select:focus {
  border-color: var(--nimo-orange);
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.14);
}

.ai-log {
  display: grid;
  gap: 9px;
  max-height: 220px;
  overflow: auto;
  margin: 12px 0;
}

.bubble {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--nimo-surface-2);
  color: var(--nimo-muted);
  font-size: 0.9rem;
}

.bubble.user {
  background: var(--nimo-ink);
  color: white;
}

.panel-section {
  margin: 0;
  padding: 16px 0;
  border: 0;
  border-bottom: 1px solid #ece7df;
  border-radius: 0;
  box-shadow: none;
}

.panel-section:last-child {
  border-bottom: 0;
}

.panel-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  color: #111827;
  font-size: 1rem;
  font-weight: 800;
}

.panel-section summary::-webkit-details-marker {
  display: none;
}

.panel-section summary::after {
  content: "+";
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--nimo-line);
  border-radius: 999px;
  color: #64748b;
  font-weight: 800;
}

.panel-section[open] summary::after {
  content: "-";
}

.panel-section p {
  margin: 10px 0 14px;
  font-size: 0.92rem;
}

.ai-panel,
.nimo-prompt-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.08);
}

.ai-panel {
  margin: 10px -10px 14px;
  padding: 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.68);
}

.nimo-prompt-panel {
  padding: 16px;
}

.ai-panel > *,
.nimo-prompt-panel > * {
  position: relative;
  z-index: 1;
}

.ai-panel::before,
.nimo-prompt-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff5a7a, #ffb15f, #25d6a2, #31c4ff, #8b6cff, #ff65d8, #ff5a7a);
  background-size: 300% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: nimoPromptBorderFlow 3600ms linear infinite;
  pointer-events: none;
}

.ai-panel::after,
.nimo-prompt-panel::after {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 90, 122, 0.16), rgba(37, 214, 162, 0.11), rgba(49, 196, 255, 0.14), rgba(255, 101, 216, 0.12));
  background-size: 260% 100%;
  filter: blur(22px);
  opacity: 0.7;
  animation: nimoPromptGlowFlow 5200ms ease-in-out infinite;
  pointer-events: none;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.prompt-chip {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--nimo-line);
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 700;
}

.prompt-chip:hover {
  border-color: #d7dce3;
  background: #ffffff;
}

.ai-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.upload-grid,
.adapt-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.upload-card {
  padding: 18px;
}

.adapt-mobile-rail {
  display: none;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 130px;
  padding: 18px;
  border: 1.5px dashed #d8dde6;
  border-radius: 18px;
  background: #fbfaf8;
  text-align: center;
  color: var(--nimo-charcoal);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.drop-zone:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.06);
}

.drop-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 14px;
  background: white;
  color: #64748b;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  font-size: 1.3rem;
  font-weight: 900;
}

.drop-copy strong {
  display: block;
  margin-bottom: 4px;
}

.drop-copy span {
  color: var(--nimo-muted);
  font-size: 0.88rem;
}

.import-status {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--nimo-line);
  border-radius: 14px;
  background: #fbfaf8;
}

.import-status strong {
  display: block;
  margin-bottom: 6px;
}

.import-status pre {
  max-height: 150px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 10px;
  background: white;
  color: var(--nimo-muted);
  white-space: pre-wrap;
  font-size: 0.82rem;
}

.import-status.warning {
  border-color: #e5b14d;
  background: #fff8e8;
}

.jobs-list {
  display: grid;
  gap: 14px;
}

.job-card {
  padding: 16px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 18px;
  background: white;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.045);
}

.job-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.job-card-header strong {
  font-size: 0.98rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.generated-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.generation-progress {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 122, 26, 0.22);
  border-radius: 16px;
  background: linear-gradient(135deg, #fff9f3, #ffffff);
  box-shadow: 0 14px 30px rgba(255, 122, 26, 0.09);
}

.generation-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--nimo-charcoal);
  font-size: 0.9rem;
}

.generation-progress-copy span {
  color: var(--nimo-muted);
  font-weight: 800;
  text-align: right;
}

.generation-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffe4d4;
}

.generation-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--nimo-orange), #ffb15f, var(--nimo-coral));
  box-shadow: 0 0 18px rgba(255, 107, 44, 0.34);
  transition: width 280ms ease;
}

.action-row {
  justify-content: flex-end;
  margin-top: 14px;
}

.generated-card {
  padding: 15px;
  position: relative;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.generated-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.generated-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.icon-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--nimo-line);
  border-radius: 10px;
  background: white;
  color: var(--nimo-muted);
  font-weight: 900;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: #d7dce3;
  background: #f8fafc;
  color: #334155;
}

.icon-btn.danger {
  border-color: #ffd4c2;
  color: #a93619;
}

.icon-btn.danger:hover {
  background: #fff4ee;
}

.icon-btn .ui-icon {
  width: 17px;
  height: 17px;
}

.generated-thumb {
  height: 180px;
  overflow: hidden;
  margin: 14px 0;
  border: 1px solid var(--nimo-line);
  border-radius: 14px;
  background: #fbfaf8;
}

.generated-thumb .resume-canvas {
  transform: scale(0.17);
  transform-origin: top left;
  box-shadow: none;
}

.generating-card {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 122, 26, 0.36);
  background: linear-gradient(180deg, #ffffff 0%, #fff6ed 100%);
  box-shadow: 0 22px 54px rgba(255, 122, 26, 0.17), 0 0 0 6px rgba(255, 122, 26, 0.06);
  animation: softGlow 1700ms ease-in-out infinite;
}

.generating-card::after {
  content: "";
  position: absolute;
  inset: -45% auto -45% -60%;
  width: 54%;
  transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  animation: placeholderSweep 1900ms ease-in-out infinite;
}

.generating-card > * {
  position: relative;
  z-index: 1;
}

.ai-generating-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
}

.generating-preview {
  display: grid;
  min-height: 180px;
  place-items: center;
  margin: 14px 0;
  border-radius: 14px;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 179, 111, 0.34), transparent 34%),
    linear-gradient(135deg, rgba(255, 122, 26, 0.18), rgba(240, 82, 61, 0.10));
}

.generating-preview.compact {
  grid-template-columns: 24px 1fr;
  min-height: 70px;
  margin: 0;
  padding: 14px;
  gap: 12px;
  place-items: center stretch;
}

.generating-page {
  display: grid;
  width: 72px;
  height: 96px;
  gap: 8px;
  align-content: start;
  padding: 14px 12px;
  border-radius: 10px;
  background: white;
  box-shadow: 0 16px 36px rgba(92, 46, 12, 0.16);
}

.generating-page span,
.generating-lines span {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 122, 26, 0.16), rgba(240, 82, 61, 0.36), rgba(255, 122, 26, 0.16));
  background-size: 220% 100%;
  animation: lineShimmer 1300ms ease-in-out infinite;
}

.generating-page span:nth-child(1) {
  width: 74%;
  height: 10px;
}

.generating-page span:nth-child(2) {
  width: 100%;
}

.generating-page span:nth-child(3) {
  width: 88%;
}

.generating-page span:nth-child(4) {
  width: 58%;
}

.generating-lines {
  display: grid;
  gap: 8px;
}

.generating-lines span:nth-child(1) {
  width: 86%;
}

.generating-lines span:nth-child(2) {
  width: 64%;
}

.generating-lines span:nth-child(3) {
  width: 78%;
}

.generating-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--nimo-orange);
  box-shadow: 0 0 0 8px rgba(255, 122, 26, 0.12), 0 0 28px rgba(255, 122, 26, 0.48);
  animation: dotPulse 1200ms ease-in-out infinite;
}

.master-preview {
  height: 300px;
  overflow: hidden;
  margin-top: 14px;
  border: 1px solid var(--nimo-line);
  border-radius: 16px;
  background: #fbf7f2;
}

.success-burst {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  width: min(390px, calc(100vw - 36px));
  min-height: 74px;
  padding: 15px 17px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 247, 241, 0.96)),
    radial-gradient(circle at 14% 0%, rgba(255, 179, 111, 0.42), transparent 38%);
  color: var(--nimo-charcoal);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.16), 0 0 0 7px rgba(255, 107, 44, 0.08);
  backdrop-filter: blur(18px) saturate(1.2);
  font-weight: 900;
  overflow: hidden;
  animation: successPop 2600ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.success-burst::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--nimo-orange), #ffb15f, var(--nimo-coral));
}

.success-burst strong,
.success-burst small {
  display: block;
}

.success-burst small {
  margin-top: 2px;
  color: var(--nimo-muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.success-check {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--nimo-orange), var(--nimo-coral));
  box-shadow: 0 12px 26px rgba(255, 107, 44, 0.3);
}

.success-check::before {
  content: "n";
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 950;
  line-height: 1;
}

.success-check::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 5px 12px rgba(22, 163, 74, 0.28);
}

.success-confetti {
  position: absolute;
  width: 8px;
  height: 14px;
  border-radius: 999px;
  background: var(--nimo-orange);
  opacity: 0;
  animation: confettiPop 950ms ease-out forwards;
}

.success-confetti:nth-child(3) {
  left: 22px;
  top: 8px;
  transform: rotate(24deg);
}

.success-confetti:nth-child(4) {
  right: 34px;
  top: 12px;
  background: var(--nimo-purple);
  animation-delay: 80ms;
}

.success-confetti:nth-child(5) {
  right: 82px;
  bottom: 10px;
  height: 8px;
  background: var(--nimo-mint);
  animation-delay: 130ms;
}

.success-confetti:nth-child(6) {
  left: 86px;
  bottom: 12px;
  background: var(--nimo-coral);
  animation-delay: 180ms;
}

.canvas-swap {
  animation: canvasSwap 280ms ease both;
}

@keyframes cardIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes successPop {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.92);
  }
  10% {
    opacity: 1;
    transform: translateY(-4px) scale(1.03);
  }
  18%, 78% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}

@keyframes confettiPop {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.4) rotate(0);
  }

  30% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(-22px) scale(1) rotate(150deg);
  }
}

@keyframes canvasSwap {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softGlow {
  0%, 100% {
    box-shadow: 0 22px 54px rgba(255, 122, 26, 0.15), 0 0 0 6px rgba(255, 122, 26, 0.05);
  }

  50% {
    box-shadow: 0 26px 62px rgba(255, 122, 26, 0.24), 0 0 0 8px rgba(255, 122, 26, 0.09);
  }
}

@keyframes placeholderSweep {
  0% {
    left: -60%;
  }

  100% {
    left: 132%;
  }
}

@keyframes lineShimmer {
  0% {
    background-position: 220% 0;
  }

  100% {
    background-position: -60% 0;
  }
}

@keyframes dotPulse {
  0%, 100% {
    transform: scale(0.9);
    opacity: 0.72;
  }

  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes nimoPromptBorderFlow {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 300% 50%;
  }
}

@keyframes nimoPromptGlowFlow {
  0%, 100% {
    background-position: 0% 50%;
    opacity: 0.52;
  }

  50% {
    background-position: 100% 50%;
    opacity: 0.82;
  }
}

.master-preview .resume-canvas {
  transform: scale(0.28);
  transform-origin: top left;
  box-shadow: none;
}

@media (max-width: 1080px) {
  .editor-shell,
  .upload-grid,
  .adapt-grid,
  .page-hero-row {
    grid-template-columns: 1fr;
  }

  .side-dock {
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--nimo-line);
  }

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

  .generation-progress-copy {
    display: grid;
  }

  .generation-progress-copy span {
    text-align: left;
  }
}

@media (hover: none) {
  .template-actions {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 680px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-section {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #ece7df;
    padding: 8px 4px;
  }

  .toolbar-section:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 760px) {
  .site-header {
    position: sticky;
    min-height: 58px;
    padding: 8px 10px;
    gap: 8px;
  }

  .brand {
    min-height: 38px;
  }

  .brand-mark {
    min-width: 66px;
    height: 36px;
    padding: 0 13px;
    border-radius: 12px;
  }

  .brand-product {
    display: none;
  }

  .header-actions {
    width: auto;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .header-actions .btn.small {
    flex: 0 0 auto;
    width: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 12px;
    font-size: 0;
  }

  .header-actions .btn.small .nav-icon {
    margin: 0;
  }

  .header-actions .export-menu .btn.small {
    width: 48px;
  }

  .header-actions .export-menu .btn.small .nav-icon:last-child {
    width: 14px;
    margin-left: -4px;
  }

  .export-menu-list {
    position: fixed;
    top: auto;
    right: 10px;
    bottom: calc(128px + env(safe-area-inset-bottom));
    z-index: 84;
  }

  .language-switch {
    flex: 0 0 auto;
    min-height: 36px;
  }

  .language-switch button {
    min-width: 34px;
    min-height: 28px;
    padding: 0 8px;
  }

  .editor-shell {
    display: block;
    min-height: calc(100svh - 58px);
    padding-bottom: calc(132px + env(safe-area-inset-bottom));
    background: #f5f1ed;
  }

  .canvas-workspace {
    min-height: calc(100svh - 58px);
    padding: 8px;
  }

  .canvas-scroll {
    height: calc(100svh - 204px);
    min-height: 420px;
    align-content: start;
    justify-content: center;
    padding: 12px;
    border-radius: 18px;
    -webkit-overflow-scrolling: touch;
  }

  .canvas-hint {
    margin: 8px 4px 0;
    font-size: 0.82rem;
  }

  .tool-strip {
    position: fixed;
    top: auto;
    right: 0;
    bottom: calc(61px + env(safe-area-inset-bottom));
    left: 0;
    z-index: 62;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
    scrollbar-width: none;
  }

  .tool-strip::-webkit-scrollbar {
    display: none;
  }

  .toolbar-section {
    flex: 0 0 auto;
    width: auto;
    min-height: 56px;
    padding: 7px;
    border: 1px solid #ece7df;
    border-radius: 14px;
    background: #ffffff;
  }

  .toolbar-section:last-child {
    border: 1px solid #ece7df;
  }

  .toolbar-label {
    font-size: 0.72rem;
  }

  .tool-input {
    width: 58px;
    height: 42px;
    border-radius: 12px;
  }

  .tool-select {
    max-width: 124px;
    height: 42px;
    border-radius: 12px;
  }

  .tool-color {
    width: 44px;
    height: 42px;
  }

  .btn.icon,
  .segmented-icon-group .tool-button {
    width: 42px;
    min-height: 42px;
  }

  .selection-status {
    min-height: 36px;
    white-space: nowrap;
  }

  .side-dock {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 76;
    height: min(72svh, 610px);
    padding: 46px 16px calc(18px + env(safe-area-inset-bottom));
    overflow: auto;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    border-left: 0;
    border-radius: 22px 22px 0 0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -24px 70px rgba(17, 24, 39, 0.2);
    transform: translateY(112%);
    transition: transform 220ms cubic-bezier(0.2, 0.85, 0.2, 1);
  }

  body.is-mobile-sheet-open .side-dock {
    transform: translateY(0);
  }

  .mobile-sheet-close {
    position: absolute;
    top: 10px;
    right: 12px;
    display: grid;
    width: 36px;
    min-height: 36px;
    place-items: center;
    border: 1px solid var(--nimo-line);
    border-radius: 12px;
    background: #ffffff;
    color: var(--nimo-ink);
  }

  .mobile-sheet-close .ui-icon {
    width: 18px;
    height: 18px;
  }

  .side-dock .panel-section {
    display: none;
    padding-top: 0;
    border-bottom: 0;
  }

  .side-dock .panel-section.is-mobile-active {
    display: block;
  }

  .ai-panel {
    margin: 0;
    padding: 14px 12px;
  }

  .mobile-editor-rail {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -12px 32px rgba(17, 24, 39, 0.1);
    backdrop-filter: blur(18px) saturate(1.18);
  }

  .mobile-editor-rail button {
    display: grid;
    min-width: 0;
    min-height: 48px;
    place-items: center;
    gap: 2px;
    padding: 4px 2px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #475569;
    font-size: 0.68rem;
    font-weight: 850;
  }

  .mobile-export-actions {
    display: grid;
    gap: 10px;
  }

  .mobile-export-actions .btn {
    width: 100%;
    min-height: 50px;
  }

  .mobile-editor-rail button[aria-expanded="true"],
  .mobile-editor-rail button:focus-visible {
    background: var(--nimo-orange-soft);
    color: var(--nimo-orange-dark);
    outline: none;
  }

  .mobile-editor-rail .ui-icon {
    width: 20px;
    height: 20px;
  }

  .mobile-editor-rail button[data-mobile-panel="ai"] {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 10px 24px rgba(255, 101, 216, 0.2), 0 0 0 3px rgba(255, 107, 44, 0.08);
  }

  .mobile-editor-rail button[data-mobile-panel="ai"] > * {
    position: relative;
    z-index: 1;
  }

  .mobile-editor-rail button[data-mobile-panel="ai"]::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    padding: 2px;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff5a7a, #ffb15f, #25d6a2, #31c4ff, #8b6cff, #ff65d8, #ff5a7a);
    background-size: 300% 100%;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: nimoPromptBorderFlow 2400ms linear infinite;
    pointer-events: none;
  }

  .mobile-editor-rail button[data-mobile-panel="ai"]::after {
    content: "";
    position: absolute;
    inset: -32%;
    z-index: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255, 90, 122, 0.32), rgba(37, 214, 162, 0.24), rgba(49, 196, 255, 0.28), rgba(255, 101, 216, 0.3));
    background-size: 260% 100%;
    filter: blur(16px);
    opacity: 0.82;
    animation: nimoPromptGlowFlow 3600ms ease-in-out infinite;
    pointer-events: none;
  }

  .toast,
  .success-burst {
    bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .adapt-shell {
    min-height: calc(100svh - 58px);
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
    background: #f7f6f3;
  }

  .adapt-hero {
    padding: 18px 0 10px;
  }

  .adapt-hero .container,
  .adapt-grid {
    width: min(100%, calc(100vw - 20px));
    padding-right: 0;
    padding-left: 0;
  }

  .adapt-hero .eyebrow {
    margin-bottom: 6px;
  }

  .adapt-hero .section-title {
    font-size: 1.35rem;
    line-height: 1.14;
  }

  .adapt-hero .lead {
    margin-top: 9px;
    font-size: 0.94rem;
  }

  .adapt-shell .header-actions [data-generate] {
    display: none;
  }

  .adapt-grid {
    display: block;
  }

  .adapt-workspace {
    display: block;
  }

  .adapt-grid [data-adapt-panel] {
    display: none;
  }

  .adapt-grid [data-adapt-panel].is-mobile-active {
    display: block;
  }

  .upload-card,
  .nimo-prompt-panel,
  .adapt-results-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .upload-card h2,
  .nimo-prompt-panel h2,
  .adapt-results-panel h2 {
    font-size: 1.06rem;
  }

  .upload-card > p,
  .panel p {
    font-size: 0.88rem;
  }

  .drop-zone {
    min-height: 108px;
    padding: 14px;
    border-radius: 16px;
  }

  .drop-icon {
    width: 38px;
    height: 38px;
    margin-bottom: 8px;
    border-radius: 12px;
  }

  .field textarea {
    min-height: 116px;
  }

  [data-adapt-prompt] {
    min-height: 88px !important;
  }

  .job-card {
    padding: 13px;
    border-radius: 16px;
  }

  .job-card-header {
    gap: 8px;
    margin-bottom: 10px;
  }

  .job-card-header .btn.small {
    min-height: 38px;
    padding: 0 11px;
  }

  .action-row {
    display: none;
  }

  .master-preview {
    height: 224px;
    margin-top: 12px;
    border-radius: 14px;
  }

  .master-preview .resume-canvas {
    transform: scale(0.21);
    transform-origin: top center;
  }

  .generated-grid {
    gap: 12px;
    margin-top: 12px;
  }

  .generated-card {
    padding: 13px;
    border-radius: 16px;
  }

  .generated-card:hover {
    transform: none;
  }

  .generated-card .button-row {
    flex-wrap: nowrap;
    gap: 7px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .generated-card .button-row::-webkit-scrollbar {
    display: none;
  }

  .generated-card .btn.small {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 11px;
  }

  .generated-thumb {
    height: 220px;
    margin: 12px 0;
  }

  .generated-thumb .resume-canvas {
    transform: scale(0.22);
    transform-origin: top center;
  }

  .generation-progress {
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
  }

  .modal {
    padding: 10px;
  }

  .modal-dialog {
    width: 100%;
    border-radius: 18px;
  }

  .modal-body {
    padding: 10px;
  }

  .modal-body .canvas-scroll {
    max-height: calc(100svh - 118px);
    min-height: 0;
    padding: 10px;
    border-radius: 14px;
  }

  .adapt-mobile-rail {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(88px, 1.05fr);
    gap: 5px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -12px 32px rgba(17, 24, 39, 0.1);
    backdrop-filter: blur(18px) saturate(1.18);
  }

  .adapt-mobile-rail button {
    display: grid;
    min-width: 0;
    min-height: 54px;
    place-items: center;
    gap: 1px;
    padding: 4px 2px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #475569;
    font-size: 0.68rem;
    font-weight: 850;
  }

  .adapt-mobile-rail strong,
  .adapt-mobile-rail small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .adapt-mobile-rail small {
    color: #94a3b8;
    font-size: 0.62rem;
    font-weight: 800;
  }

  .adapt-mobile-rail .ui-icon {
    width: 19px;
    height: 19px;
  }

  .adapt-mobile-rail button[aria-pressed="true"] {
    background: var(--nimo-orange-soft);
    color: var(--nimo-orange-dark);
  }

  .adapt-mobile-rail button[aria-pressed="true"] small {
    color: var(--nimo-orange-dark);
  }

  .adapt-mobile-generate {
    background: var(--nimo-orange) !important;
    color: #ffffff !important;
    box-shadow: var(--shadow-glow);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-panel::before,
  .ai-panel::after,
  .nimo-prompt-panel::before,
  .nimo-prompt-panel::after {
    animation: none;
  }
}
