:root {
  color-scheme: light;
  --bg: #edf1f5;
  --panel: #ffffff;
  --ink: #151923;
  --muted: #687083;
  --line: #d9e0e7;
  --accent: #176b87;
  --accent-strong: #0f4f66;
  --soft: #e8f3f1;
  --danger: #b42318;
  --success: #16794c;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 2%, rgba(23, 107, 135, 0.16), transparent 28%),
    radial-gradient(circle at 92% 10%, rgba(138, 79, 45, 0.12), transparent 26%),
    linear-gradient(180deg, #f8fafc 0, #edf1f5 48%, #e8edf2 100%),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 86px);
  padding: 0 22px 22px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px 14px;
}

.app-header h1 {
  font-size: 1.45rem;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.header-meta span,
.completion-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #405064;
  padding: 7px 11px;
  font-size: 0.8rem;
  font-weight: 800;
}

.input-panel,
.preview-panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.input-panel {
  max-height: calc(100vh - 100px);
  padding: 18px;
  overflow: auto;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: calc(100vh - 100px);
  padding: 18px;
}

.brand-row,
.preview-header,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-row {
  justify-content: flex-start;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #176b87, #2f5d50);
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(23, 107, 135, 0.24);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.25rem;
}

form {
  display: grid;
  gap: 12px;
}

.form-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfcfd);
  padding: 14px;
}

.section-heading h3 {
  margin: 0 0 3px;
  font-size: 0.95rem;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #303846;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.14);
}

button {
  border: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, #176b87, #0f4f66);
  color: #fff;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover:not(:disabled) {
  background: linear-gradient(135deg, #0f4f66, #123f52);
  box-shadow: 0 10px 18px rgba(15, 79, 102, 0.18);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #2b3b4f;
}

.secondary-btn:hover:not(:disabled) {
  background: #f4f7f9;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.toolbar button {
  min-height: 38px;
}

.photo-field {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.photo-field span {
  grid-column: 1 / -1;
}

.photo-preview {
  display: none;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.template-picker {
  display: grid;
  gap: 9px;
  margin: 2px 0;
  padding: 0;
  border: 0;
}

.template-picker legend {
  margin-bottom: 7px;
  color: #303846;
  font-size: 0.92rem;
  font-weight: 800;
}

.template-card {
  grid-template-columns: auto 34px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.template-card:hover {
  border-color: rgba(23, 107, 135, 0.38);
  transform: translateY(-1px);
}

.template-card input {
  width: 17px;
  height: 17px;
}

.template-card strong,
.template-card small {
  display: block;
}

.template-card small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 600;
}

.template-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
  background: var(--soft);
}

.readiness-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.readiness-panel div {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.check-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #bcc6d1;
}

.check-dot.ready {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 121, 76, 0.12);
}

.template-swatch {
  width: 34px;
  height: 44px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.template-swatch.executive {
  background: linear-gradient(#e8f3f1 0 34%, #ffffff 34% 100%);
}

.template-swatch.modern {
  background: linear-gradient(#1f2937 0 34%, #ffffff 34% 100%);
}

.template-swatch.classic {
  background: linear-gradient(90deg, #ffffff 0 72%, #eef4ef 72% 100%);
}

.status {
  min-height: 24px;
  margin: 14px 0;
  color: var(--muted);
  font-weight: 700;
}

.status.error {
  color: var(--danger);
}

.progress {
  display: none;
  position: relative;
  height: 7px;
  margin: -4px 0 14px;
  overflow: hidden;
  border-radius: 99px;
  background: #dfe7e6;
}

.progress.active {
  display: block;
}

.progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, #176b87, #2f5d50, #8a4f2d);
  animation: progress-slide 1.2s ease-in-out infinite;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-105%);
  }

  100% {
    transform: translateX(245%);
  }
}

.resume-preview {
  flex: 1;
  min-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    #f5f7fa;
  background-size: 24px 24px;
  padding: 24px;
  line-height: 1.48;
}

.resume-preview::before {
  display: none;
}

.resume-preview > * {
  max-width: 820px;
}

.resume-preview.template-executive,
.resume-preview.template-modern,
.resume-preview.template-classic {
  color: #1f2937;
}

.resume-document {
  min-height: 920px;
  max-width: 820px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  box-shadow: 0 22px 50px rgba(20, 32, 46, 0.14);
}

.is-processing .input-panel,
.is-processing .preview-panel {
  filter: saturate(0.78);
}

.designed-document {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
}

.resume-sidebar {
  padding: 34px 28px;
  background: #e8f3f1;
}

.resume-sidebar img,
.photo-placeholder {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  object-fit: cover;
}

.resume-sidebar img,
.resume-sidebar .photo-placeholder {
  display: block;
  margin: 0 auto 24px;
}

.photo-placeholder {
  display: inline-grid;
  place-items: center;
  background: #d8e3e1;
  color: #5f6f74;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.contact-line {
  margin: 8px 0 0;
  color: #52606d;
  font-weight: 700;
}

.resume-main {
  min-width: 0;
  padding: 42px 38px;
}

.designed-header {
  margin: -42px -38px 28px;
  padding: 42px 38px 26px;
}

.resume-preview h1 {
  color: #102a43;
  font-size: 2rem;
  margin-bottom: 8px;
}

.resume-section {
  margin: 0 0 22px;
}

.resume-section h2 {
  margin: 0 0 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  color: #176b87;
  font-size: 0.96rem;
  text-transform: uppercase;
}

.template-modern .resume-section h2 {
  color: #8a4f2d;
}

.template-classic .resume-section h2 {
  color: #2f5d50;
}

.resume-sidebar .resume-section {
  margin-bottom: 20px;
}

.resume-sidebar .resume-section h2 {
  font-size: 0.78rem;
}

.resume-preview h3 {
  margin: 14px 0 6px;
  font-size: 1rem;
}

.resume-preview p,
.resume-preview ul {
  margin: 7px 0;
}

.resume-preview ul {
  padding-left: 20px;
}

.resume-preview li {
  margin: 4px 0;
}

.resume-sidebar,
.resume-sidebar li,
.resume-sidebar p {
  font-size: 0.86rem;
}

.template-modern .designed-document {
  grid-template-columns: 210px minmax(0, 1fr);
}

.template-modern .resume-sidebar {
  padding-top: 42px;
  background: linear-gradient(#1f2937 0 154px, #f3ebe4 154px 100%);
}

.template-modern .designed-header {
  background: #1f2937;
}

.template-modern .designed-header h1 {
  color: #fff;
}

.template-modern .designed-header .contact-line {
  color: #d9e3e7;
}

.template-classic .classic-document {
  padding: 42px 48px;
}

.classic-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 22px;
  align-items: center;
  margin-bottom: 26px;
  border-bottom: 3px solid #2f5d50;
  padding-bottom: 16px;
}

.classic-header img,
.classic-header .photo-placeholder {
  width: 78px;
  height: 78px;
}

.classic-document .resume-main {
  padding: 0;
}

.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  border: 1px dashed #c5ced8;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.resume-editor {
  display: none;
  flex: 1;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #111827;
  color: #ecf2f8;
  padding: 20px;
  line-height: 1.55;
  resize: none;
}

.resume-editor.active {
  display: block;
}

.hidden {
  display: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(8px);
}

.loading-overlay.active {
  display: grid;
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(10px);
}

.crop-modal.active {
  display: grid;
}

.crop-card {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.96));
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.3);
  padding: 20px;
}

.crop-header,
.crop-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crop-stage {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 24px auto;
  overflow: hidden;
  border-radius: 50%;
  background: #d8e3e1;
  cursor: grab;
  touch-action: none;
  box-shadow:
    0 0 0 12px rgba(23, 107, 135, 0.08),
    0 18px 36px rgba(15, 23, 42, 0.18);
}

.crop-stage:active {
  cursor: grabbing;
}

.crop-stage img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.crop-mask {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.crop-controls {
  align-items: end;
}

.crop-controls label {
  flex: 1;
}

.crop-controls input[type="range"] {
  padding: 0;
}

.loader-card {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 252, 0.94));
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  padding: 28px;
  text-align: center;
}

.loader-visual {
  position: relative;
  display: grid;
  place-items: center;
  height: 156px;
  margin-bottom: 16px;
}

.loader-page {
  position: relative;
  z-index: 2;
  width: 116px;
  height: 148px;
  border: 1px solid #d6e0e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
  padding: 18px 14px;
  animation: page-float 2.4s ease-in-out infinite;
}

.loader-avatar {
  display: block;
  width: 34px;
  height: 34px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #176b87, #d8e3e1);
}

.loader-line,
.loader-rule {
  display: block;
  height: 6px;
  margin: 8px auto;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef3;
}

.loader-line::after,
.loader-rule::after {
  content: "";
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(23, 107, 135, 0.5), transparent);
  animation: shimmer 1.4s ease-in-out infinite;
}

.loader-line {
  width: 76%;
}

.loader-line.long {
  width: 88%;
}

.loader-line.medium {
  width: 64%;
}

.loader-line.short {
  width: 48%;
}

.loader-rule {
  width: 86%;
  height: 2px;
  margin: 12px auto;
  background: #d6e0e7;
}

.loader-ring {
  position: absolute;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  border: 2px solid rgba(23, 107, 135, 0.14);
  border-top-color: #176b87;
  border-right-color: #8a4f2d;
  animation: loader-spin 1.15s linear infinite;
}

.loader-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.loader-card h2 {
  margin: 0;
  color: #142334;
  font-size: 1.35rem;
}

.loader-card p {
  color: var(--muted);
}

.loader-steps {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 18px;
}

.loader-steps span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #176b87;
  animation: step-pulse 1s ease-in-out infinite;
}

.loader-steps span:nth-child(2) {
  animation-delay: 160ms;
  background: #2f5d50;
}

.loader-steps span:nth-child(3) {
  animation-delay: 320ms;
  background: #8a4f2d;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes page-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(240%);
  }
}

@keyframes step-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.9);
  }

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

.revise-form {
  grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
  align-items: stretch;
  gap: 12px;
  margin-top: 16px;
  width: 100%;
  min-width: 0;
}

.revise-form label {
  display: contents;
  min-width: 0;
}

.revise-label-text {
  grid-column: 1 / -1;
  color: #303846;
  font-size: 0.92rem;
  font-weight: 800;
}

.revise-form textarea {
  grid-column: 1;
  min-width: 0;
  min-height: 72px;
  max-height: 140px;
  resize: vertical;
}

.revise-form button {
  grid-column: 2;
  align-self: stretch;
  width: 100%;
  white-space: nowrap;
  padding-inline: 18px;
}

@media (max-width: 980px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .input-panel,
  .preview-panel {
    max-height: none;
  }

  .preview-panel {
    min-height: 70vh;
  }
}

@media (max-width: 620px) {
  .field-grid,
  .revise-form,
  .readiness-panel {
    grid-template-columns: 1fr;
  }

  .preview-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar button {
    flex: 1 1 auto;
  }

  .revise-form button {
    grid-column: 1;
    min-height: 44px;
  }

  .revise-form textarea {
    grid-column: 1;
  }

  .input-panel,
  .preview-panel {
    padding: 16px;
  }

  .resume-preview {
    padding: 20px;
  }

  .designed-document {
    grid-template-columns: 1fr;
  }

  .resume-sidebar {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 14px;
    padding: 20px;
  }

  .resume-sidebar img,
  .resume-sidebar .photo-placeholder {
    margin: 0;
    width: 74px;
    height: 74px;
  }

  .resume-sidebar .resume-section {
    margin-bottom: 12px;
  }

  .resume-main,
  .classic-document {
    padding: 24px;
  }

  .designed-header {
    margin: -24px -24px 22px;
    padding: 24px;
  }

  .classic-header {
    grid-template-columns: 1fr;
  }

  .resume-preview h1 {
    font-size: 1.55rem;
  }

  .loader-card {
    padding: 22px;
  }

  .crop-card {
    padding: 16px;
  }

  .crop-header,
  .crop-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .crop-stage {
    width: 230px;
    height: 230px;
  }

  .loader-visual {
    height: 136px;
  }

  .loader-page {
    width: 100px;
    height: 130px;
  }

  .loader-ring {
    width: 120px;
    height: 120px;
  }
}
