:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --text: #111111;
  --text-muted: #6e6e73;
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.14);
  --shadow-soft: 0 20px 50px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, #ffffff 0%, #f5f5f7 45%, #ececf0 100%);
  min-height: 100vh;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 22px 72px;
  display: flex;
  flex-direction: column;
  gap: 34px;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.page-title-text {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #1d1d1f;
}

.page-links {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.84rem;
}

.page-links a {
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.page-links a:hover {
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

.controls-card,
.live-preview-card {
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.controls-card {
  background: var(--surface);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.controls-header h1 {
  margin: 0 0 4px;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.controls-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 0.82rem;
  color: #3a3a3c;
  font-weight: 500;
}

input,
select {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  font-size: 0.92rem;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder {
  color: #9a9aa1;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-preview {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f0f0f3;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  display: none;
  object-fit: cover;
}

.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.actions {
  display: flex;
  gap: 10px;
}

.btn {
  border-radius: 999px;
  padding: 10px 18px;
  border: 1px solid transparent;
  font-size: 0.84rem;
  font-weight: 500;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease,
    background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.subtle,
.btn.outline {
  border-color: var(--border);
}

.btn.accent {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(0, 113, 227, 0.22);
}

.btn.accent:hover {
  background: #0066cc;
}

.color-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.color-swatch.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.live-preview-card {
  width: 100%;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  position: relative;
}

.live-preview-card canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  color: #444446;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-arrow:hover {
  border-color: #d2d2d7;
  color: #1d1d1f;
}

.nav-arrow-left {
  left: -14px;
}

.nav-arrow-right {
  right: -14px;
}

.templates {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.templates-header h2 {
  margin: 0 0 4px;
  font-size: 1.06rem;
}

.templates-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.templates-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.templates-tab {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.74);
  color: #3a3a3c;
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
}

.templates-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.templates-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.templates-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.templates-group h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: #2f2f31;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.template-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.12);
}

.template-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-card);
}

.template-thumb {
  position: relative;
  height: 140px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 12px;
}

.template-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.26), rgba(0, 0, 0, 0));
}

.template-thumb .demo {
  position: relative;
  z-index: 1;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
}

.template-info {
  padding: 12px;
}

.template-info h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

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

  .controls-card {
    order: 2;
  }

  .live-preview-card {
    order: 1;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 20px 14px 48px;
    gap: 24px;
  }

  .page-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-arrow-left {
    left: 6px;
  }

  .nav-arrow-right {
    right: 6px;
  }

  .actions {
    flex-wrap: wrap;
  }
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f2f4f7;
  --gray-200: #eaecf0;
  --gray-300: #d0d5dd;
  --gray-500: #667085;
  --gray-700: #344054;
  --gray-900: #101828;
  --green-500: #12b76a;
  --green-100: #d1fadf;
  --shadow-soft: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-card: 0 4px 16px rgba(16, 24, 40, 0.06);
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --border: #eaecf0;
  --text: #101828;
  --text-muted: #667085;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px 72px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-title-text {
  margin: 0;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(16, 24, 40, 1);
  text-align: left;
}

.page-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
}

.page-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.page-links a:hover {
  color: var(--green-500);
}

.hero {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 32px;
  align-items: center;
}

.live-preview-card {
  width: 100%;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  padding: 20px 20px 18px;
  position: relative;
}

.live-preview-card canvas {
  width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.nav-arrow:hover {
  border-color: var(--green-500);
  color: var(--green-500);
}

.nav-arrow-left {
  left: -16px;
}

.nav-arrow-right {
  right: -16px;
}

.controls-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.controls-header h1 {
  font-size: 1.125rem;
  margin: 0 0 4px;
}

.controls-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 0.875rem;
  color: var(--text);
}

input,
select {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 0.95rem;
  color: var(--text);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px var(--green-100);
  background: var(--surface);
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-preview {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--surface-muted);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  appearance: none;
}

.select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.actions {
  display: flex;
  gap: 12px;
}

.color-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  position: relative;
  padding: 0;
  flex: 0 0 auto;
}

.color-swatch.selected {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}

.btn {
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--surface);
  cursor: pointer;
}

.btn.subtle {
  border-color: var(--border);
}

.btn.outline {
  border-color: var(--border);
  color: var(--text);
}

.btn.accent {
  border-color: var(--green-500);
  color: var(--green-500);
  background: var(--surface);
}

.templates {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.templates-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.templates-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.templates-tab.active {
  border-color: var(--green-500);
  color: var(--green-500);
  box-shadow: 0 0 0 2px var(--green-100);
}

.templates-header h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.templates-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.templates-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.templates-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.templates-group h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.template-card {
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card.selected {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100), var(--shadow-card);
}

.template-thumb {
  position: relative;
  height: 140px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 12px;
}

.template-thumb .demo {
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.template-info {
  padding: 12px;
}

.template-info h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .hero {
    grid-template-columns: 1fr;
  }
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f2f4f7;
  --gray-200: #eaecf0;
  --gray-300: #d0d5dd;
  --gray-500: #667085;
  --gray-700: #344054;
  --gray-900: #101828;
  --green-500: #12b76a;
  --green-100: #d1fadf;
  --shadow-soft: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-card: 0 4px 16px rgba(16, 24, 40, 0.06);
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --border: #eaecf0;
  --text: #101828;
  --text-muted: #667085;
}

body[data-theme="dark"] {
  --bg: #0b0f14;
  --surface: #12171f;
  --surface-muted: #0f141b;
  --border: #1f2937;
  --text: #f8fafc;
  --text-muted: #9aa4b2;
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 8px 20px rgba(0, 0, 0, 0.35);
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px 72px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.hero {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 32px;
  align-items: center;
}

.live-preview-card {
  width: 100%;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  padding: 20px 20px 18px;
  position: relative;
}

.live-preview-card canvas {
  width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-700);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.nav-arrow:hover {
  border-color: var(--green-500);
  color: var(--green-500);
}

.nav-arrow-left {
  left: -16px;
}

.nav-arrow-right {
  right: -16px;
}

.controls-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.controls-header h1 {
  font-size: 1.125rem;
  margin: 0 0 4px;
}

.controls-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 0.875rem;
  color: var(--text);
}

input,
select {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 0.95rem;
  color: var(--text);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px var(--green-100);
  background: var(--surface);
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-preview {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--surface-muted);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  appearance: none;
}

.select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.actions {
  display: flex;
  gap: 12px;
}

.color-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: var(--white);
  cursor: pointer;
  position: relative;
  padding: 0;
  flex: 0 0 auto;
}

.color-swatch.selected {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}

.btn {
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--surface);
  cursor: pointer;
}

.btn.subtle {
  border-color: var(--border);
}

.btn.outline {
  border-color: var(--border);
  color: var(--text);
}

.btn.accent {
  border-color: var(--green-500);
  color: var(--green-500);
  background: var(--surface);
}

.templates {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.templates-header h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.templates-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.template-card {
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card.selected {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100), var(--shadow-card);
}

.template-thumb {
  position: relative;
  height: 140px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 12px;
}

.template-thumb .demo {
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.template-info {
  padding: 12px;
}

.template-info h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.template-info span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.theme-toggle .toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text);
}

.toggle-btn {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  position: relative;
  cursor: pointer;
  padding: 0;
}

.toggle-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease;
}

body[data-theme="dark"] .toggle-indicator {
  transform: translateX(20px);
  background: #0b0f14;
}

@media (max-width: 640px) {
  .hero {
    grid-template-columns: 1fr;
  }
}
/* ============================================
   XP Card Studio — Premium Minimal UI
   ============================================ */

:root {
  --white: #FFFFFF;
  --gray-25: #FCFCFD;
  --gray-50: #F9FAFB;
  --gray-100: #F2F4F7;
  --gray-200: #EAECF0;
  --gray-300: #D0D5DD;
  --gray-400: #98A2B3;
  --gray-500: #667085;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #1D2939;
  --gray-900: #101828;

  --green-50: #ECFDF3;
  --green-100: #D1FADF;
  --green-200: #A6F4C5;
  --green-400: #32D583;
  --green-500: #12B76A;
  --green-600: #039855;
  --green-700: #027A48;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --shadow-xl: 0 20px 24px -4px rgba(16, 24, 40, 0.08), 0 8px 8px -4px rgba(16, 24, 40, 0.03);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-900);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============================================
   App Layout
   ============================================ */

.app {
  display: grid;
  grid-template-columns: 400px 1fr;
  min-height: 100vh;
}

/* ============================================
   Left Panel
   ============================================ */

.panel-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-100);
  overflow-y: auto;
}

/* ============================================
   Cards
   ============================================ */

.card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}

.config-card {
  flex-shrink: 0;
}

.card-header {
  padding: 24px 24px 0;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin: 0;
}

.card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 12px;
}

/* ============================================
   Fields
   ============================================ */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-700);
}

/* Input */
.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--gray-900);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: var(--gray-400);
}

.input:hover {
  border-color: var(--gray-400);
}

.input:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px var(--green-100);
}

.input-mono {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Select */
.select-wrapper {
  position: relative;
}

.select {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 14px;
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--gray-900);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select:hover {
  border-color: var(--gray-400);
}

.select:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px var(--green-100);
}

.select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--gray-500);
  pointer-events: none;
}

/* Avatar Upload */
.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-icon {
  width: 22px;
  height: 22px;
  color: var(--gray-400);
}

.avatar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-700);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-upload svg {
  width: 14px;
  height: 14px;
}

.btn-upload:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

/* ============================================
   Buttons
   ============================================ */

.btn-primary {
  flex: 1;
  height: 44px;
  padding: 0 20px;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
  background: var(--green-600);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--green-700);
}

.btn-primary:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

.btn-secondary {
  height: 44px;
  padding: 0 20px;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

/* ============================================
   Preview Card
   ============================================ */

.preview-card {
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-label {
  padding: 16px 20px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
}

.preview-canvas-wrap {
  flex: 1;
  padding: 0 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-canvas-wrap canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* ============================================
   Right Panel - Templates
   ============================================ */

.panel-right {
  padding: 24px 32px;
  overflow-y: auto;
}

.templates-header {
  margin-bottom: 24px;
}

.templates-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.templates-count {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin: 0;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Template Card */
.template-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 2px solid var(--gray-100);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card:hover {
  border-color: var(--gray-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.template-card.selected {
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px var(--green-100), var(--shadow-lg);
}

.template-preview {
  aspect-ratio: 16 / 9;
  background: var(--gray-50);
  position: relative;
  overflow: hidden;
}

.template-preview-inner {
  position: absolute;
  inset: 16px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.template-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.template-info {
  padding: 16px;
  border-top: 1px solid var(--gray-100);
}

.template-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 2px;
}

.template-author {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin: 0;
}

/* ============================================
   Modal
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.6);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
}

/* Crop */
.crop-stage {
  position: relative;
  aspect-ratio: 1;
  background: var(--gray-900);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-stage canvas {
  width: 100%;
  height: 100%;
}

.crop-ring {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px solid var(--white);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.crop-zoom {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.crop-zoom-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-600);
  flex-shrink: 0;
}

.crop-zoom input[type="range"] {
  flex: 1;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  appearance: none;
  cursor: pointer;
}

.crop-zoom input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--green-500);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* ============================================
   Responsive
   ============================================ */

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

  .panel-left {
    border-right: none;
    border-bottom: 1px solid var(--gray-100);
  }

  .preview-card {
    min-height: 200px;
  }
}

@media (max-width: 600px) {
  .panel-left {
    padding: 16px;
  }

  .panel-right {
    padding: 16px;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

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