:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-muted: #eef2f7;
  --text: #172033;
  --muted: #667085;
  --line: #d7dee8;
  --primary: #155eef;
  --primary-hover: #004eeb;
  --success: #12805c;
  --warning: #b54708;
  --danger: #c4320a;
  --coral: #e11d48;
  --shadow: 0 18px 48px rgba(23, 32, 51, 0.1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}
button, input, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 20px; height: 20px; stroke-width: 2; flex: 0 0 auto; }

.site-header {
  min-height: 68px;
  padding: 10px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; font-size: 20px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; color: #fff; background: var(--primary); border-radius: 8px; }
.site-nav { display: flex; align-items: center; gap: 22px; font-weight: 600; }
.site-nav > a:not(.button) { color: var(--text); }
.inline-form { margin: 0; }

.page-shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 48px 0 72px; }
.button {
  min-height: 44px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { color: #98a2b3; border-color: var(--line); background: #f2f4f7; cursor: default; transform: none; }
.button-primary { color: #fff; background: var(--primary); }
.button-primary:hover { color: #fff; background: var(--primary-hover); }
.button-secondary { color: var(--text); border-color: var(--line); background: var(--surface); }
.button-secondary:hover { color: var(--primary); border-color: #9bb9ff; background: #f8faff; }
.button-quiet { min-height: 38px; padding: 7px 10px; color: var(--muted); background: transparent; }
.button-small { min-height: 38px; padding: 7px 12px; }
.button-full { width: 100%; }
.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
}
.icon-button:hover { color: var(--primary); border-color: #9bb9ff; }

.flash-stack { display: grid; gap: 10px; margin-bottom: 24px; }
.flash { min-height: 46px; padding: 11px 14px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.flash-success { color: #086b4c; border-color: #9fdbc6; background: #effaf6; }
.flash-danger { color: #a72a09; border-color: #f8b4a2; background: #fff4f1; }
.flash-warning { color: #8a4700; border-color: #f6ca87; background: #fff8e8; }
.flash-info { color: #175cd3; border-color: #b2ccff; background: #eff4ff; }

.home-page { padding-top: 58px; }
.home-intro { min-height: 520px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr); align-items: center; gap: clamp(40px, 7vw, 96px); }
.home-copy { max-width: 680px; }
.eyebrow { display: block; margin-bottom: 10px; color: var(--primary); font-size: 13px; font-weight: 800; text-transform: uppercase; }
.home-copy h1, .dashboard-header h1 { margin: 0; font-size: clamp(36px, 5vw, 62px); line-height: 1.06; font-weight: 790; }
.home-copy > p { max-width: 620px; margin: 22px 0 28px; color: var(--muted); font-size: 19px; }
.quick-register { max-width: 610px; }
.quick-register > label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.input-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.form-note { margin: 10px 0 0 !important; font-size: 14px !important; }
.product-preview { padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.preview-person { display: flex; align-items: center; gap: 16px; }
.preview-person strong, .preview-person span { display: block; }
.preview-person strong { font-size: 21px; }
.preview-person span { margin-top: 3px; color: var(--muted); }
.preview-avatar { width: 64px; height: 64px; display: grid; place-items: center; color: var(--primary); border: 1px solid #c8d7ff; border-radius: 8px; background: #edf3ff; }
.preview-avatar svg { width: 34px; height: 34px; }
.product-preview > p { margin: 26px 0; color: #344054; }
.preview-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview-actions span { min-height: 46px; padding: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; border-radius: 7px; background: var(--primary); font-weight: 700; }
.preview-actions span:last-child { background: var(--success); }
.home-features { margin-top: 42px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.home-features > div { min-height: 126px; padding: 24px; display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-content: center; }
.home-features > div + div { border-left: 1px solid var(--line); }
.home-features svg { grid-row: 1 / 3; color: var(--primary); }
.home-features strong { font-size: 17px; }
.home-features span { color: var(--muted); font-size: 14px; }

input, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--text);
  border: 1px solid #b9c3d1;
  border-radius: 6px;
  outline: none;
  background: var(--surface);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.14); }
label { color: #344054; font-size: 14px; font-weight: 700; }

.auth-page { min-height: calc(100vh - 69px); display: grid; place-items: center; padding-top: 32px; }
.auth-panel { width: min(440px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.auth-icon { width: 48px; height: 48px; display: grid; place-items: center; color: var(--primary); border-radius: 8px; background: #edf3ff; }
.auth-icon-warning { color: var(--danger); background: #fff1ed; }
.auth-panel h1 { margin: 20px 0 8px; font-size: 28px; line-height: 1.2; }
.auth-panel > p { margin: 0 0 24px; color: var(--muted); }
.stack-form { display: grid; gap: 10px; }
.stack-form .button { margin-top: 8px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.label-row a { font-size: 13px; font-weight: 600; }
.auth-switch { margin: 22px 0 0 !important; text-align: center; font-size: 14px; }
.auth-message { text-align: center; }
.auth-message .auth-icon { margin: 0 auto; }

.dashboard-header { margin-bottom: 34px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.dashboard-header h1 { font-size: 42px; }
.dashboard-header p { margin: 8px 0 0; color: var(--muted); }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 32px; align-items: start; }
.profile-editor { min-width: 0; display: grid; gap: 22px; }
.editor-section { padding: 26px 0 30px; border-top: 1px solid var(--line); }
.editor-section:first-child { border-top: 0; padding-top: 0; }
.section-heading { margin-bottom: 22px; display: flex; align-items: flex-start; gap: 12px; }
.section-heading > svg { margin-top: 2px; color: var(--primary); }
.section-heading h2, .tool-heading h2 { margin: 0; font-size: 21px; }
.section-heading p, .tool-heading p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { min-width: 0; display: grid; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.counter { justify-self: end; color: var(--muted); font-size: 12px; }
.rich-editor-shell { overflow: hidden; border: 1px solid #b9c3d1; border-radius: 6px; background: var(--surface); }
.rich-editor-shell:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.14); }
.rich-toolbar { min-height: 44px; padding: 5px 7px; display: flex; align-items: center; gap: 3px; border-bottom: 1px solid var(--line); background: var(--surface-muted); }
.rich-toolbar button { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; color: var(--text); border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; }
.rich-toolbar button:hover { color: var(--primary); border-color: #b2ccff; background: #fff; }
.rich-toolbar button svg { width: 18px; height: 18px; }
.toolbar-separator { width: 1px; height: 24px; margin: 0 4px; background: var(--line); }
.rich-editor { min-height: 150px; max-height: 360px; padding: 13px; overflow-y: auto; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.rich-editor:empty::before { color: #98a2b3; content: attr(data-placeholder); pointer-events: none; }
.rich-editor p, .rich-editor div { margin: 0 0 10px; }
.rich-editor p:last-child, .rich-editor div:last-child { margin-bottom: 0; }
.rich-editor ul, .rich-editor ol { margin: 8px 0; padding-left: 24px; }
.rich-editor a { text-decoration: underline; }
.avatar-field { margin-bottom: 22px; display: flex; align-items: center; gap: 18px; }
.avatar-preview { width: 88px; height: 88px; display: grid; place-items: center; overflow: hidden; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-preview svg { width: 38px; height: 38px; }
.avatar-field p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.theme-control { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: 10px; }
.theme-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-control span { min-height: 48px; padding: 10px 14px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; }
.theme-control input:checked + span { color: var(--primary); border-color: var(--primary); background: #edf3ff; box-shadow: 0 0 0 2px rgba(21, 94, 239, 0.12); }
.editor-actions { padding: 12px; display: grid; grid-template-columns: auto minmax(220px, 1fr); gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.button-reset { min-width: 132px; }
.preview-column { position: sticky; top: 24px; display: grid; gap: 18px; }
.preview-tool, .share-tool, .password-tool { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.tool-heading { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.phone-frame { width: 100%; aspect-ratio: 9 / 14; overflow: hidden; border: 8px solid #202632; border-radius: 8px; background: #fff; }
.phone-frame iframe { width: 100%; height: 100%; border: 0; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; }
.copy-row input { min-width: 0; color: var(--muted); font-size: 13px; }
.qr-row { margin-top: 16px; display: grid; grid-template-columns: 104px 1fr; align-items: center; gap: 16px; }
.qr-row img { width: 104px; height: 104px; border: 1px solid var(--line); }
.password-tool summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 700; list-style: none; }
.password-tool summary::-webkit-details-marker { display: none; }
.password-tool summary span { display: flex; align-items: center; gap: 9px; }
.password-tool[open] summary > svg { transform: rotate(180deg); }
.compact-form { margin-top: 18px; }

.card-page { min-height: 100vh; padding: 22px; display: grid; place-items: start center; }
.card-theme-light { --card-bg: #ffffff; --card-text: #172033; --card-muted: #667085; --card-line: #dde3eb; --card-soft: #f2f5f8; --card-action: #155eef; }
.card-theme-dark { --card-bg: #171b22; --card-text: #f7f8fa; --card-muted: #aab4c3; --card-line: #343b46; --card-soft: #232933; --card-action: #4f83ff; background: #0f1217; }
.public-card { width: min(100%, 620px); padding: 24px; color: var(--card-text); border: 1px solid var(--card-line); border-radius: 8px; background: var(--card-bg); box-shadow: 0 20px 60px rgba(15, 18, 23, 0.16); }
.card-toolbar { min-height: 42px; display: flex; align-items: center; justify-content: space-between; }
.mini-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--card-muted); font-size: 13px; font-weight: 750; }
.mini-brand svg { width: 17px; height: 17px; }
.card-icon-button { color: var(--card-text); border-color: var(--card-line); background: var(--card-soft); }
.card-identity { padding: 32px 0 24px; text-align: center; }
.public-avatar { width: 116px; height: 116px; margin: 0 auto 20px; display: grid; place-items: center; overflow: hidden; color: var(--card-muted); border: 1px solid var(--card-line); border-radius: 8px; background: var(--card-soft); }
.public-avatar img { width: 100%; height: 100%; object-fit: cover; }
.public-avatar svg { width: 52px; height: 52px; }
.card-identity h1 { max-width: 100%; margin: 0; overflow-wrap: anywhere; font-size: 30px; line-height: 1.18; }
.card-position { margin: 7px 0 0; color: var(--card-muted); font-size: 17px; overflow-wrap: anywhere; }
.primary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.primary-actions a { min-height: 52px; padding: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; border-radius: 7px; background: var(--card-action); font-weight: 750; }
.primary-actions a:last-child { background: #12805c; }
.primary-actions a:hover { text-decoration: none; filter: brightness(0.95); }
.card-about { margin: 24px 0 0; padding: 22px 0; color: var(--card-text); border-top: 1px solid var(--card-line); border-bottom: 1px solid var(--card-line); overflow-wrap: anywhere; }
.card-about p, .card-about div { margin: 0 0 12px; }
.card-about p:last-child, .card-about div:last-child { margin-bottom: 0; }
.card-about ul, .card-about ol { margin: 10px 0; padding-left: 24px; }
.card-about li + li { margin-top: 5px; }
.card-about a { color: var(--card-action); text-decoration: underline; }

.crop-dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 22px; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 24px 80px rgba(16, 24, 40, 0.28); }
.crop-dialog::backdrop { background: rgba(16, 24, 40, 0.64); }
.crop-dialog-header { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.crop-dialog-header .eyebrow { margin-bottom: 3px; }
.crop-dialog-header h2 { margin: 0; font-size: 24px; }
.crop-stage { width: min(100%, 460px); aspect-ratio: 1; margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #111827; }
.crop-stage canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.crop-stage canvas.is-dragging { cursor: grabbing; }
.crop-zoom { margin: 18px auto; display: grid; grid-template-columns: 22px minmax(0, 1fr) 22px; align-items: center; gap: 12px; }
.crop-zoom input { min-height: 24px; padding: 0; border: 0; box-shadow: none; }
.crop-zoom svg { width: 20px; height: 20px; color: var(--muted); }
.crop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.social-list { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.social-list a { min-width: 0; min-height: 48px; padding: 9px 12px; display: grid; grid-template-columns: 24px minmax(0, 1fr) 18px; align-items: center; gap: 9px; color: var(--card-text); border: 1px solid var(--card-line); border-radius: 7px; background: var(--card-soft); font-weight: 650; }
.social-list a:hover { border-color: var(--card-action); text-decoration: none; }
.social-list img { width: 24px; height: 24px; }
.social-list svg { width: 17px; height: 17px; color: var(--card-muted); }
.social-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-footer-actions { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.card-footer-actions .button { color: var(--card-text); border-color: var(--card-line); background: var(--card-soft); }
.card-footer-actions .card-save-button { color: #fff; border-color: var(--card-action); background: var(--card-action); }

@media (max-width: 960px) {
  .home-intro { grid-template-columns: 1fr; min-height: auto; }
  .home-copy { max-width: 760px; }
  .product-preview { max-width: 620px; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .preview-column { position: static; grid-template-columns: 1fr 1fr; align-items: start; }
  .preview-tool { grid-row: span 2; }
}

@media (max-width: 680px) {
  .site-header { min-height: 60px; padding: 9px 15px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 34px; height: 34px; }
  .site-nav { gap: 10px; }
  .site-nav > a:not(.button) { display: none; }
  .button-quiet span { display: none; }
  .page-shell { width: min(100% - 28px, 1180px); padding: 30px 0 54px; }
  .home-page { padding-top: 36px; }
  .home-intro { gap: 36px; }
  .home-copy h1 { font-size: 39px; }
  .home-copy > p { font-size: 17px; }
  .input-action { grid-template-columns: 1fr; }
  .product-preview { padding: 20px; }
  .home-features { grid-template-columns: 1fr; }
  .home-features > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .auth-panel { padding: 24px 20px; box-shadow: none; }
  .dashboard-header { align-items: flex-start; flex-direction: column; }
  .dashboard-header h1 { font-size: 34px; }
  .dashboard-header .button { width: 100%; }
  .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .avatar-field { align-items: flex-start; }
  .editor-actions { grid-template-columns: 1fr; }
  .button-reset { min-width: 0; }
  .theme-control { grid-template-columns: 1fr 1fr; }
  .preview-column { grid-template-columns: 1fr; }
  .preview-tool { grid-row: auto; }
  .card-page { padding: 0; place-items: start stretch; }
  .public-card { min-height: 100vh; padding: 20px; border: 0; border-radius: 0; box-shadow: none; }
  .card-identity h1 { font-size: 27px; }
  .social-list { grid-template-columns: 1fr; }
  .card-footer-actions { grid-template-columns: 1fr; }
  .crop-dialog { padding: 16px; }
}

@media (max-width: 390px) {
  .site-nav .button-small { padding: 7px 9px; font-size: 13px; }
  .preview-actions { grid-template-columns: 1fr; }
  .primary-actions { grid-template-columns: 1fr; }
  .qr-row { grid-template-columns: 88px 1fr; }
  .qr-row img { width: 88px; height: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
