.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-preview-wrap {
  position: relative;
  overflow: hidden;
  background: #f6f7f9;
}

.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 {
  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;
}

.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);
}

.text-icon {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 900;
}

.shape-icon::before {
  content: "";
  width: 16px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 4px;
  background: #fff0e5;
}

.line-icon::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.image-icon::before {
  content: "";
  width: 17px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.image-icon::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 4px;
  width: 8px;
  height: 6px;
  border-radius: 2px 2px 3px 3px;
  background: linear-gradient(135deg, transparent 48%, currentColor 50%);
}

.duplicate-icon::before,
.duplicate-icon::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 4px;
  background: white;
}

.duplicate-icon::before {
  left: 2px;
  top: 5px;
  opacity: 0.52;
}

.duplicate-icon::after {
  right: 2px;
  top: 2px;
}

.delete-icon::before,
.delete-icon::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.delete-icon::before {
  transform: rotate(45deg);
}

.delete-icon::after {
  transform: rotate(-45deg);
}

.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;
}

.ai-panel {
  position: relative;
  background: #ffffff;
}

.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;
}

.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;
}

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

.upload-card {
  padding: 18px;
}

.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;
}

.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;
}

.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;
  }
}

.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;
  }
}

@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;
  }
}
