/* Phase 3: focused frontend and quality-of-life improvements. */

/* Shared focus and validation */
:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

input:user-invalid,
textarea:user-invalid,
select:user-invalid,
[aria-invalid="true"] {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px color-mix(in srgb, #dc2626 14%, transparent);
}

.form-error-summary {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, #dc2626 38%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, #dc2626 8%, var(--surface-solid));
  color: #b91c1c;
}

/* Builder saving states */
.module-form.has-unsaved-changes > .accordion-head {
  box-shadow: inset 4px 0 0 var(--accent);
}

[data-builder-save-bar].is-saving [data-builder-save] {
  cursor: progress;
  opacity: .75;
}

[data-builder-save-bar].is-error {
  border-color: color-mix(in srgb, #dc2626 42%, var(--border));
}

[data-builder-save-bar] [data-save-state] {
  min-width: 8.5rem;
  text-align: right;
}

/* Owner preview drawer */
.builder-preview[hidden] { display: none; }
.builder-preview {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 24px;
}
.builder-preview-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(5px);
  cursor: default;
}
.builder-preview-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1280px, 96vw);
  height: min(900px, 94vh);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface-solid);
  box-shadow: 0 30px 90px rgba(15, 23, 42, .32);
}
.builder-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.builder-preview-header > div { display: flex; align-items: center; gap: 8px; }
.builder-preview-canvas {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: color-mix(in srgb, var(--bg) 92%, #64748b);
}
.builder-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 14px;
  background: white;
  box-shadow: 0 12px 36px rgba(15, 23, 42, .16);
  transition: width .2s ease, height .2s ease;
}
.builder-preview[data-preview-size="mobile"] .builder-preview-frame {
  width: min(390px, 100%);
  height: min(844px, 100%);
}
body.has-builder-preview { overflow: hidden; }

/* Public profile navigation: one compact sticky row */
.pro-profile { padding-top: 0; }
.public-profile-topbar-card {
  position: sticky;
  top: 64px;
  z-index: 34;
  display: grid;
  gap: 0;
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: 0 0 20px 20px;
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
  backdrop-filter: blur(16px);
}
.public-profile-topbar-main {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  opacity: 0;
  transition: grid-template-rows .2s ease, opacity .2s ease;
}
.public-profile-topbar-main > * { min-height: 0; }
.public-profile-topbar-main.is-visible {
  grid-template-rows: 1fr;
  opacity: 1;
}
.public-profile-topbar-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 2px;
}
.public-profile-topbar-identity img,
.public-profile-topbar-identity > span {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent);
  color: white;
  font-weight: 800;
}
.public-profile-topbar-identity div { min-width: 0; }
.public-profile-topbar-identity strong,
.public-profile-topbar-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.public-profile-topbar-identity small { color: var(--muted); }

.profile-nav.pro-nav {
  position: relative;
  top: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 8px;
  overflow: hidden;
  border: 0;
  border-radius: inherit;
  background: transparent;
  box-shadow: none;
}
.profile-nav-track {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  scroll-snap-type: inline proximity;
}
.profile-nav-track::-webkit-scrollbar { display: none; }
.profile-nav-track a {
  flex: 0 0 auto;
  scroll-snap-align: start;
}
.profile-nav-track a[aria-current] {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
.profile-nav-arrow {
  display: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
}
.profile-nav.has-overflow .profile-nav-arrow { display: grid; place-items: center; }
.profile-nav-arrow:disabled { opacity: .35; cursor: default; }

/* Public hero and primary action */
.pro-hero h1 {
  max-width: 13ch;
  font-size: clamp(2.35rem, 6vw, 4.8rem);
  overflow-wrap: anywhere;
}
.hero-meta > :where(a, span) {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.ui-icon {
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.hero-primary-action { box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 28%, transparent); }
.profile-preview-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  margin: 0 -22px 12px;
  padding: 8px 14px;
  text-align: center;
  background: #f59e0b;
  color: #111827;
  font-size: .88rem;
  font-weight: 700;
}

/* More scannable resume, skills and projects */
.resume-public-grid { align-items: start; }
.resume-public-card.is-primary {
  grid-column: 1 / -1;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-solid));
}
.skills-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
.skill-chip,
.skill-item {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-solid);
}
.skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
}
.skill-chip small,
.skill-level { color: var(--muted); }
.skill-item { min-width: min(280px, 100%); overflow: hidden; }
.skill-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 13px;
  cursor: pointer;
  list-style: none;
}
.skill-item summary::-webkit-details-marker { display: none; }
.skill-item[open] { border-radius: 16px; }
.skill-detail { padding: 0 13px 13px; }
.skill-detail p { margin: 3px 0 10px; }
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
  gap: 18px;
}
.project-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.project-card .item-image {
  aspect-ratio: 16 / 10;
  max-height: none;
  border-radius: 16px;
}
.project-card .project-lead {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}
.project-tags { margin-top: auto; padding-top: 10px; }
.project-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.project-detail { margin-top: 10px; }
.project-detail summary { cursor: pointer; font-weight: 700; }

/* Gallery: stable ratio, clear controls, keyboard-friendly thumbnails */
.gallery-carousel-media {
  min-height: 0;
  aspect-ratio: 16 / 10;
  max-height: min(72vh, 720px);
}
.gallery-carousel-media > img,
.gallery-carousel-media .ba-hold,
.gallery-carousel-media .ba-hold img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-carousel-arrow[hidden] { display: none !important; }
.gallery-thumb[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent);
}
.ba-hold-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 12px auto 0;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}
.ba-hold-control[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
.public-gallery-carousel:focus-visible { border-radius: 16px; }

@media (max-width: 760px) {
  .builder-preview { padding: 8px; }
  .builder-preview-panel { width: 100%; height: 96vh; border-radius: 18px; }
  .builder-preview-header { align-items: flex-start; }
  .builder-preview-header > div:first-child { display: none; }
  .builder-preview-canvas { padding: 8px; }
  .pro-profile { padding-top: 0; }
  .profile-preview-banner { margin-inline: -12px; }
  .public-profile-topbar-card { top: 58px; border-radius: 0 0 16px 16px; }
  .profile-nav.has-overflow .profile-nav-arrow { display: none; }
  .profile-nav.pro-nav { grid-template-columns: minmax(0, 1fr); }
  .pro-hero h1 { max-width: 100%; font-size: clamp(2.25rem, 14vw, 3.6rem); }
  .hero-actions > * { flex: 1 1 170px; text-align: center; justify-content: center; }
  .resume-public-card.is-primary { grid-column: auto; }
  .gallery-carousel-media { aspect-ratio: 4 / 3; max-height: 66vh; }
  [data-builder-save-bar] [data-save-state] { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .builder-preview-frame,
  .public-profile-topbar-main { transition: none; }
}

/* Phase 4: profile types, branding, leads and product extensions. */
.public-profile-page[style*="--profile-accent"] {
  --accent: var(--profile-accent);
  --primary: var(--profile-accent);
}

.profile-template-minimal .pro-hero,
.profile-template-minimal .profile-section,
.profile-template-minimal .public-profile-topbar-card {
  box-shadow: none;
  backdrop-filter: none;
}
.profile-template-minimal .pro-hero { background: var(--surface-solid); border-radius: 18px; }
.profile-template-minimal .profile-section { border-radius: 18px; }
.profile-template-studio .pro-hero {
  background:
    radial-gradient(circle at 90% 10%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 34%),
    linear-gradient(145deg, color-mix(in srgb, var(--surface-solid) 96%, transparent), color-mix(in srgb, var(--accent) 8%, var(--surface-solid)));
}
.profile-template-studio .profile-section { border-left: 4px solid color-mix(in srgb, var(--accent) 52%, var(--border)); }
.profile-type-company .hero-photo img { object-fit: contain; padding: 18px; background: var(--surface-solid); }

.company-profile-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
}
.company-profile-facts span { display: grid; gap: 4px; color: var(--muted); }
.company-profile-facts strong { color: var(--text); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }

.service-grid,
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.service-card { display: grid; gap: 14px; align-content: start; }
.service-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.service-card-head h3 { margin: 0; flex: 1 1 140px; }
.service-card-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--accent) 12%, var(--surface-solid)); }
.service-card details summary { cursor: pointer; font-weight: 700; }
.team-card { text-align: center; }
.team-card > img,
.team-placeholder { width: 112px; height: 112px; margin: 0 auto 14px; border-radius: 50%; object-fit: cover; }
.team-placeholder { display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, var(--surface-solid)); font-size: 2rem; font-weight: 800; }
.team-links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.contact-layout { display: grid; grid-template-columns: minmax(180px, .75fr) minmax(0, 1.35fr); gap: 24px; align-items: start; }
.public-lead-form { display: grid; gap: 14px; padding: 22px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface-solid); }
.public-lead-form h3 { margin: 0; }
.public-lead-form textarea { min-height: 140px; }
.lead-honeypot { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.profile-base-form { display: grid; gap: 18px; }
.profile-settings-section { max-width: 1080px; width: 100%; margin: 0 auto; padding: 26px; }
.profile-settings-section h2 { margin-top: 0; }
.profile-settings-section[hidden] { display: none; }
.profile-settings-submit { position: sticky; bottom: 14px; z-index: 10; max-width: 1080px; width: 100%; margin: 0 auto; display: flex; justify-content: flex-end; padding: 12px; border: 1px solid var(--border); border-radius: 18px; background: color-mix(in srgb, var(--surface-solid) 88%, transparent); backdrop-filter: blur(14px); }
.settings-history { margin-top: 14px; }
.settings-history code { overflow-wrap: anywhere; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-row .pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.lead-list { display: grid; gap: 16px; }
.lead-card { display: grid; gap: 14px; }
.lead-card > header { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.lead-card h2 { margin: 6px 0; }
.lead-card time { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.lead-contact { display: flex; gap: 12px; flex-wrap: wrap; }
.lead-message { white-space: pre-wrap; line-height: 1.7; }
.lead-card.status-new { border-left: 4px solid var(--accent); }

@media (max-width: 760px) {
  .contact-layout { grid-template-columns: 1fr; }
  .company-profile-facts { grid-template-columns: 1fr 1fr; }
  .profile-settings-section { padding: 20px; }
  .profile-settings-submit { bottom: 8px; }
  .lead-card > header { display: grid; }
  .lead-card time { white-space: normal; }
}

@media (max-width: 440px) {
  .company-profile-facts { grid-template-columns: 1fr; }
}

/* Export Center: three-step resume and business-card flow. */
.export-flow-page { display: grid; gap: 26px; }
.export-flow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.export-flow-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--muted);
  background: var(--surface);
}
.export-flow-steps li span {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  font-size: .82rem;
  font-weight: 800;
}
.export-flow-steps li strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.export-flow-steps li.is-active { color: var(--text); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.export-flow-steps li.is-active span { border-color: var(--accent); background: var(--accent); color: #fff; }
.export-flow-steps li.is-complete { color: var(--text); }
.export-flow-steps li.is-complete span { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); color: var(--accent); }

.export-type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.export-type-card {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(0, 1.2fr);
  gap: 24px;
  align-items: center;
  min-height: 310px;
  padding: 26px;
  color: var(--text);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.export-type-card:hover,
.export-type-card:focus-visible { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 58%, var(--border)); box-shadow: 0 18px 48px rgba(15, 23, 42, .14); }
.export-type-card h2 { margin: 0 0 10px; font-size: clamp(1.55rem, 3vw, 2.1rem); }
.export-type-card p { margin: 0 0 20px; color: var(--muted); line-height: 1.65; }
.export-type-card .button { pointer-events: none; }
.export-type-visual {
  position: relative;
  min-height: 250px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 42%), var(--surface-solid);
}
.export-type-icon {
  position: absolute;
  top: 14px;
  left: 14px;
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .04em;
}
.export-mini-document {
  width: 128px;
  height: 178px;
  padding: 23px 18px;
  display: grid;
  align-content: start;
  gap: 13px;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .2);
  transform: rotate(-3deg);
}
.export-mini-document::before { content: ''; width: 44px; height: 44px; border-radius: 50%; background: #dbeafe; }
.export-mini-document i { display: block; height: 6px; border-radius: 999px; background: #d8e0eb; }
.export-mini-document i:nth-child(2) { width: 72%; }
.export-mini-document i:nth-child(4) { width: 84%; }
.export-mini-card {
  width: 205px;
  aspect-ratio: 85 / 55;
  position: relative;
  border-radius: 13px;
  background: linear-gradient(135deg, #fff, #e8f0ff);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .2);
  transform: rotate(3deg);
}
.export-mini-card::before { content: ''; position: absolute; left: 20px; top: 23px; width: 88px; height: 9px; border-radius: 999px; background: #1d4ed8; box-shadow: 0 21px 0 #cbd5e1, 0 39px 0 #e2e8f0; }
.export-mini-card::after { content: ''; position: absolute; right: 18px; top: 25px; width: 48px; height: 48px; border: 7px solid #111827; background: repeating-linear-gradient(45deg, #111827 0 3px, #fff 3px 6px); }

.export-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.export-section-heading h2 { margin: 0; }
.export-history-card { margin-top: 4px; }
.export-history-list > div { grid-template-columns: minmax(130px, 1fr) 70px 100px minmax(150px, auto); }
.export-history-list time { color: var(--muted); text-align: right; }

.export-template-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 22px; align-items: start; }
.export-template-card { display: grid; grid-template-rows: auto auto; align-content: start; gap: 14px; padding: 14px; }
.export-template-copy { display: grid; align-content: start; gap: 8px; min-width: 0; }
.export-template-copy h2 { margin: 0; }
.export-template-copy p {
  margin: 0 0 4px;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.export-template-copy .button { justify-self: start; position: relative; z-index: 1; }
.export-template-thumbnail {
  position: relative;
  width: 100%;
  min-height: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #edf2f7;
}
.export-template-thumbnail[class*="resume-"] { padding: 16px; }
.template-resume-header {
  height: 70px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 13px;
  background: #fff;
  border-bottom: 1px solid #dbe3ec;
}
.template-resume-header i { width: 42px; height: 42px; border-radius: 10px; background: #dbeafe; }
.template-resume-header span { width: 70%; height: 10px; border-radius: 999px; background: #1e3a5f; box-shadow: 0 19px 0 #9aa8ba; }
.template-resume-body { min-height: 190px; display: grid; grid-template-columns: 34% minmax(0, 1fr); background: #fff; }
.template-resume-body aside,
.template-resume-body main { padding: 18px 13px; display: grid; align-content: start; gap: 15px; }
.template-resume-body aside { border-right: 1px solid #e2e8f0; }
.template-resume-body b { height: 7px; border-radius: 999px; background: #cbd5e1; }
.template-resume-body main b:nth-child(1) { width: 42%; background: #2563eb; }
.template-resume-body main b:nth-child(3) { width: 82%; }
.resume-modern .template-resume-header { color: #fff; background: linear-gradient(135deg, #16365f, #2563eb); border: 0; }
.resume-modern .template-resume-header span { background: #fff; box-shadow: 0 19px 0 rgba(255,255,255,.55); }
.resume-modern .template-resume-body aside { color: #fff; background: #172a46; border: 0; }
.resume-modern .template-resume-body aside b { background: #7185a1; }
.resume-minimal .template-resume-header { grid-template-columns: 1fr; background: #fff; border-bottom: 2px solid #111827; }
.resume-minimal .template-resume-header i { display: none; }
.resume-minimal .template-resume-header span { width: 55%; background: #111827; box-shadow: 0 19px 0 #9ca3af; }
.resume-minimal .template-resume-body { grid-template-columns: 1fr; }
.resume-minimal .template-resume-body aside { display: none; }

.export-template-thumbnail[class*="card-"] {
  min-height: 0;
  aspect-ratio: 85 / 55;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 60px;
  align-content: center;
  align-items: center;
  gap: 12px;
  padding: 24px;
  background: linear-gradient(135deg, #fff, #eaf1ff);
}
.template-card-content { display: grid; align-content: center; gap: 12px; min-width: 0; }
.template-card-content i { width: 35px; height: 35px; border-radius: 9px; background: #dbeafe; }
.template-card-content b { width: 76%; height: 10px; border-radius: 999px; background: #1e3a5f; }
.template-card-content span { display: block; width: 92%; height: 6px; border-radius: 999px; background: #aeb9c7; }
.template-card-content span:last-child { width: 68%; }
.template-card-qr { width: 52px; height: 52px; border: 7px solid #111827; background: repeating-linear-gradient(45deg, #111827 0 3px, #fff 3px 6px); }
.card-dark { background: linear-gradient(140deg, #111827, #1e3a5f) !important; }
.card-dark .template-card-content b { background: #fff; }
.card-dark .template-card-content span { background: #94a3b8; }
.card-dark .template-card-qr { border-color: #fff; }
.card-minimal { background: #fff !important; border: 2px solid #111827; border-radius: 0; }
.card-minimal .template-card-content i { border-radius: 50%; background: #e5e7eb; }
.card-minimal .template-card-content b { width: 60%; background: #111827; }

.export-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 350px); gap: 24px; align-items: start; }
.export-preview-panel { min-width: 0; padding: 16px; }
.export-preview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 2px 2px 14px; }
.export-preview-toolbar > div { display: grid; gap: 3px; }
.export-preview-toolbar span { color: var(--muted); font-size: .88rem; }
.export-preview-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #dfe5ed;
}
.export-preview-frame iframe { display: block; width: 100%; border: 0; background: #fff; }
.export-preview-frame.is-resume iframe { min-height: 76vh; }
.export-preview-frame.is-business-card iframe { min-height: 460px; }
.export-download-panel { position: sticky; top: 92px; display: grid; gap: 12px; }
.export-download-panel h2 { margin: 0; }
.export-download-panel > p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.6; }
.export-format-list { display: grid; gap: 12px; margin: 10px 0; }
.export-format-option {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-solid);
  transition: border-color .18s ease, transform .18s ease;
}
.export-format-option:hover,
.export-format-option:focus-visible { border-color: var(--accent); transform: translateY(-1px); }
.export-format-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); font-size: .75rem; font-weight: 900; }
.export-format-option > span:last-child { display: grid; gap: 4px; }
.export-format-option small { color: var(--muted); line-height: 1.35; }
.export-generation-note { padding-top: 12px; border-top: 1px solid var(--border); font-size: .84rem; }
.full-width { width: 100%; justify-content: center; }

@media (max-width: 980px) {
  .export-type-card { grid-template-columns: 1fr; }
  .export-type-visual { min-height: 210px; }
  .export-template-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .export-detail-layout { grid-template-columns: 1fr; }
  .export-download-panel { position: static; }
}

@media (max-width: 680px) {
  .export-flow-steps { gap: 6px; }
  .export-flow-steps li { display: grid; justify-items: center; gap: 5px; padding: 9px 5px; text-align: center; }
  .export-flow-steps li strong { width: 100%; font-size: .73rem; }
  .export-type-grid,
  .export-template-grid { grid-template-columns: 1fr; }
  .export-type-card { min-height: 0; padding: 18px; }
  .export-type-visual { min-height: 190px; }
  .export-template-thumbnail { min-height: 0; }
  .export-history-list > div { grid-template-columns: 1fr auto; }
  .export-history-list time { text-align: left; }
  .export-preview-toolbar { align-items: flex-start; }
  .export-preview-frame.is-resume iframe { min-height: 68vh; }
  .export-preview-frame.is-business-card iframe { min-height: 360px; }
}

/* Focused dashboard, analytics and editor layout adjustments. */
.analytics-page > .dashboard-grid { margin-bottom: 15px; }
.dashboard-analytics-qr-grid,
.modules-dashboard { margin-top: 22px; }
.dashboard-analytics-qr-grid {
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: stretch;
}
.dashboard-analytics-qr-grid > .card { min-width: 0; }
.dashboard-analytics-card { align-content: start; }
.dashboard-analytics-card .button { justify-self: start; }
.dashboard-analytics-qr-grid .qr-card { height: 100%; }
.dashboard-analytics-qr-grid .qr-card p { overflow-wrap: anywhere; }
.dashboard-analytics-qr-grid > .qr-card:only-child {
  grid-column: 1 / -1;
  justify-self: end;
  width: min(100%, 300px);
}
.modules-dashboard { grid-template-columns: minmax(0, 1fr); }
.modules-dashboard > .wide { grid-column: 1; }

.profile-editor-heading {
  position: relative;
  min-height: 48px;
  padding-right: 190px;
}
.profile-settings-save {
  position: absolute;
  top: 0;
  right: 0;
  width: auto;
}
.profile-settings-save:disabled {
  border-color: #94a3b8;
  background: #94a3b8;
  color: #fff;
  cursor: not-allowed;
  opacity: .75;
}


.builder-toolbar.compact-module-toolbar {
  position: static;
  z-index: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px 20px;
}
.builder-toolbar-copy {
  min-width: 220px;
  flex: 1 1 auto;
}
.builder-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 1 auto;
  flex-wrap: wrap;
  margin-left: auto;
}
.builder-toolbar-actions [data-save-state] {
  min-width: auto;
  white-space: nowrap;
}
.module-form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}
.module-form-actions button[type="submit"] { margin-left: auto; }

@media (max-width: 760px) {
  .dashboard-analytics-qr-grid { grid-template-columns: 1fr; }
  .dashboard-analytics-qr-grid > .qr-card:only-child {
    justify-self: stretch;
    width: 100%;
  }
  .profile-editor-heading { padding-right: 0; }
  .profile-settings-save {
    position: static;
    margin-top: 14px;
  }
  .builder-toolbar.compact-module-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }
  .builder-toolbar-copy { min-width: 0; }
  .builder-toolbar-actions {
    justify-content: flex-start;
    margin-left: 0;
  }
  .builder-toolbar-actions [data-builder-save] { margin-left: auto; }
}
