/* Site theme: warm and homey, drawn from the Porchlight logo (lamplight amber on cream).
   Light by default; dark ("evening") when the user picks it in account settings (data-theme on
   <html>, see templates/base.html) or when their OS prefers dark and they haven't picked light.
   The two dark blocks must stay identical. Public card pages don't use this: cards have their own colors. */
:root {
  color-scheme: light;
  --font-body: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --bg: #fbf6ee;
  --surface: #fffdf9;
  --surface-hover: #f6eee2;
  --subtle: #f1e7d8;
  --input-bg: #fffdf9;
  --text: #2e241b;
  --muted: #75614f;
  --border: #eadfcf;
  --primary: #b4500f;
  --primary-hover: #983f08;
  --on-primary: #ffffff;
  --link: #a2470c;
  --danger: #b42318;
  --danger-hover: #931c13;
  --success-bg: #edf5e6;
  --success-text: #3f6b2a;
  --error-bg: #fbece5;
  --error-text: #9a3412;
  --glow: rgba(243, 123, 6, .13);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(92, 58, 24, .06), 0 8px 24px rgba(92, 58, 24, .07);
  --popover-shadow: 0 12px 40px rgba(92, 58, 24, .18);
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #17120e;
  --surface: #211a14;
  --surface-hover: #2b231b;
  --subtle: #2e251d;
  --input-bg: #1b1510;
  --text: #f4ebdf;
  --muted: #b3a292;
  --border: #3a2f25;
  --primary: #e8863a;
  --primary-hover: #f09a52;
  --on-primary: #1f150c;
  --link: #f2a65e;
  --danger: #c2331f;
  --danger-hover: #d9442e;
  --success-bg: #1f2a17;
  --success-text: #b5d99c;
  --error-bg: #3a1c14;
  --error-text: #f5b39b;
  --glow: rgba(243, 123, 6, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --popover-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    color-scheme: dark;
    --bg: #17120e;
    --surface: #211a14;
    --surface-hover: #2b231b;
    --subtle: #2e251d;
    --input-bg: #1b1510;
    --text: #f4ebdf;
    --muted: #b3a292;
    --border: #3a2f25;
    --primary: #e8863a;
    --primary-hover: #f09a52;
    --on-primary: #1f150c;
    --link: #f2a65e;
    --danger: #c2331f;
    --danger-hover: #d9442e;
    --success-bg: #1f2a17;
    --success-text: #b5d99c;
    --error-bg: #3a1c14;
    --error-text: #f5b39b;
    --glow: rgba(243, 123, 6, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
    --popover-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
/* In-page links (#section) glide to their target, unless the device asks for less motion. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: radial-gradient(ellipse 900px 460px at 50% -140px, var(--glow), transparent 70%) no-repeat, var(--bg);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.container { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 440px; }
.main { padding: 40px 0 64px; }

/* Nav */
.nav { position: relative; z-index: 20; background: color-mix(in srgb, var(--surface) 70%, transparent); border-bottom: 1px solid var(--border); }
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; flex: none; }
.nav-end { display: flex; align-items: center; gap: 16px; }
.nav-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav-links form { margin: 0; }
.nav-toggle {
  display: grid; place-items: center; width: 40px; height: 40px; margin-right: -8px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-hover); }
.nav-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-toggle[hidden], .nav-toggle-close { display: none; }
.nav-toggle svg { width: 24px; height: 24px; }
.nav.is-open .nav-toggle-open { display: none; }
.nav.is-open .nav-toggle-close { display: inline; }

/* Small screens: the links become a panel under the bar, opened by the menu button. Only once nav.js
   has run (.has-menu), so without JavaScript the links still show, wrapped. */
@media (max-width: 760px) {
  .brand { font-size: 1.2rem; }
  .nav-end { gap: 8px; }
  .nav.has-menu .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px 20px 20px;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .nav.has-menu.is-open .nav-links { display: flex; }
  .nav.has-menu .nav-links > a:not(.btn) { padding: 14px 4px; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 600; }
  .nav.has-menu .nav-links > .btn { margin-top: 16px; }
}
@media (min-width: 761px) {
  .nav-toggle { display: none !important; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
  background: var(--primary); color: var(--on-primary); text-decoration: none;
  transition: background-color .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-link { background: none; border: none; color: var(--link); padding: 0; font-weight: 500; }
.btn-link:hover { background: none; text-decoration: underline; }
.btn-block { width: 100%; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.panel + .panel { margin-top: 20px; }
/* Panels laid out in a grid are spaced by the grid gap, not by the stacking margin above. */
.features > .panel, .card-grid > .panel { margin-top: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
h1 { font-size: 2rem; line-height: 1.15; }
h2 { font-size: 1.3rem; line-height: 1.25; margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 24px; }
.messages li { padding: 12px 18px; border-radius: 14px; margin-bottom: 8px; background: var(--success-bg); color: var(--success-text); }
.messages li.error { background: var(--error-bg); color: var(--error-text); }

/* Forms */
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.form-row input[type=text], .form-row input[type=email], .form-row input[type=url],
.form-row input[type=password], .form-row textarea {
  width: 100%; padding: 10px 14px; font: inherit; color: inherit; border: 1px solid var(--border);
  border-radius: 12px; background: var(--input-bg);
}
.form-row input:focus, .form-row textarea:focus { outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent); outline-offset: 0; border-color: var(--primary); }
.form-row input[type=color] { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); }
.form-row .helptext, .form-row .help { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.form-row .helptext ul { margin: 4px 0 0; padding-left: 18px; }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--danger); font-size: .85rem; }
.form-check { display: flex; align-items: center; gap: 8px; }
/* A radio group as a stack of selectable boxes (includes/field.html). */
.choice-list { min-width: 0; padding: 0; border: 0; }
.choice-list legend { padding: 0; margin-bottom: 6px; font-weight: 700; font-size: .9rem; }
.form-row label.choice {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; font-weight: 500; cursor: pointer;
}
.form-row label.choice:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.choice input { flex: none; margin: 3px 0 0; accent-color: var(--primary); }
.form-check label { margin: 0; }
/* A checkbox drawn as an on/off switch. It stays a real checkbox, so it works with the keyboard
   and screen readers, and without JavaScript. */
.switch { gap: 12px; }
.switch input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; margin: 0;
  width: 44px; height: 26px; border-radius: 999px; background: var(--subtle);
  box-shadow: inset 0 0 0 1px var(--border); cursor: pointer; transition: background-color .15s;
}
.switch input[type=checkbox]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch input[type=checkbox]:checked { background: var(--primary); box-shadow: none; }
.switch input[type=checkbox]:checked::after { transform: translateX(18px); }
.switch input[type=checkbox]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch label { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-section { margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* Hero */
.hero { padding: 40px 0 32px; text-align: center; }
.hero h1 { font-size: clamp(2.3rem, 6vw, 3.75rem); font-weight: 600; margin: 0 0 18px; letter-spacing: -.02em; }
.hero h1 em { font-style: italic; font-weight: 500; color: var(--primary); }
.eyebrow {
  display: inline-block; margin-bottom: 18px; padding: 6px 16px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--link);
  font-size: .9rem; font-weight: 700;
}
.hero p { font-size: 1.2rem; color: var(--muted); max-width: 560px; margin: 0 auto 30px; text-wrap: balance; }
.hero .form-actions { justify-content: center; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 32px; }
.features .panel h2 { margin-bottom: 6px; }
.feature-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 14px; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.feature-icon svg { width: 22px; height: 22px; }
.features .panel p { margin: 0; color: var(--muted); }

/* 404 page */
.not-found { padding-top: 40px; }
.not-found-lamp { display: block; width: 120px; height: 120px; margin: 0 auto 8px; color: var(--text); }

/* Services page */
.hero-compact { padding: 48px 0 40px; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.service-grid > .panel { margin-top: 0; }
.service h2 { margin-bottom: 8px; }
.service p { margin: 0 0 12px; color: var(--muted); }
.service p:last-child { margin-bottom: 0; }
.cta { margin-top: 32px; text-align: center; padding: 40px 28px; }
.cta p { margin: 0 0 20px; }

/* Dashboard */
.page-intro { margin: 4px 0 0; }
.page-head .eyebrow { margin-bottom: 10px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 24px; }
/* Dashboard tile: a miniature of the card, with its banner bleeding to the panel's edges. */
.card-tile { display: flex; flex-direction: column; gap: 16px; padding-top: 0; overflow: hidden; }
.tile-banner { position: relative; height: 84px; margin: 0 -28px; background: var(--accent); }
.tile-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-avatar {
  position: relative; display: grid; place-items: center; flex: none; width: 72px; height: 72px; overflow: hidden;
  border: 4px solid var(--surface); border-radius: 50%; background: var(--accent); color: var(--on-accent);
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; box-shadow: 0 4px 12px rgba(92, 58, 24, .15);
}
.tile-avatar > * { grid-area: 1 / 1; }
.tile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tile-avatar [hidden] { display: none; }
.card-tile .tile-avatar { margin: -52px 0 -6px; }
.card-tile h2 { margin: 0 0 2px; }
.tile-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.card-tile .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.card-tile .actions .btn { padding: 8px 16px; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 18px; }
.empty-icon svg { width: 28px; height: 28px; }
.empty .btn { margin-top: 8px; }

/* Card manage page */
.back-link { display: inline-block; margin-bottom: 12px; }
.card-head-title { display: flex; align-items: center; gap: 16px; }
.card-head .tile-status { margin-top: 6px; }
.head-actions { margin: 0; }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-title .feature-icon { margin: 0; }
.section-title h2 { margin: 0; }
.steps { margin: 0 0 20px; padding-left: 22px; }
.steps li { margin-bottom: 6px; padding-left: 4px; }
.steps li::marker { color: var(--primary); font-family: var(--font-display); font-weight: 600; }
.field-label { display: block; margin-bottom: 6px; font-size: .9rem; font-weight: 700; }
.copy-field + .small { margin: 6px 0 18px; }
.activity-stats { margin-bottom: 20px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.danger-zone .feature-icon { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.stat-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.empty { text-align: center; padding: 56px 28px; }

.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; min-width: 0; padding: 10px 12px; font: inherit; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; color: inherit; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
td.ua { color: var(--muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* Card editor: the card itself is the form. Inputs take on the card's typography, and
   .is-previewing strips the editing chrome and hides empty fields, like the public page. */
.card-editor { position: relative; max-width: 440px; margin: 0 auto; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.editor-bar .btn { margin-left: auto; }
.mode-toggle { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--subtle); }
.mode-toggle[hidden] { display: none; }
.mode-toggle button { font: inherit; font-size: .9rem; font-weight: 600; padding: 6px 14px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.mode-toggle button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }

.canvas { background: var(--backdrop); border: 1px solid var(--border); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); }
.canvas .card { padding-bottom: 28px; }
.canvas .made-with { pointer-events: none; }  /* preview only: don't open the site mid-edit */
.swatch { flex: none; display: inline-block; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
/* Pill buttons on the banner (Cover, Color). Light and opaque so they read on any color or photo. */
.banner-button {
  position: absolute; top: 12px; display: flex; align-items: center; gap: 6px; height: 30px;
  padding: 4px 10px 4px 4px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .92);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  font: inherit; font-size: .8rem; font-weight: 600; color: #14151a; cursor: pointer;
}
.banner-button:hover { background: #fff; }
.banner-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.accent-picker { right: 12px; }
.cover-button { left: 12px; padding-left: 10px; }
.cover-button svg { width: 16px; height: 16px; }
/* The cover upload and link sit in the gap between the Cover and Color buttons, clear of the avatar. */
.cover-field { position: absolute; top: 12px; left: 104px; right: 100px; z-index: 2; font-size: .8rem; }
.canvas .cover-field input:not([type="file"]) {
  height: 30px; padding: 4px 12px; border-radius: 999px; text-align: left;
  background: var(--sheet); color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.canvas .cover-field input:hover { background: var(--sheet); }
.cover-field .errorlist { margin: 4px 0 0; padding: 4px 8px; border-radius: 6px; background: var(--sheet); }

/* Upload and Remove pills, then the link field, in the photo and cover popovers. */
.image-field-row { display: flex; align-items: center; gap: 6px; }
.image-field-row input:not([type="file"]) { flex: 1; min-width: 0; }
.image-upload, .image-remove {
  flex: none; display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 0; border-radius: 999px;
  font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.image-upload { background: var(--accent); color: var(--on-accent); }
.image-upload:hover { filter: brightness(1.08); }
.image-upload:focus-within { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.image-upload.is-busy { opacity: .7; cursor: progress; }
.image-remove { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.image-remove:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.cover-field .image-upload, .cover-field .image-remove { box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.photo-field .image-field-row { justify-content: center; }

/* Image cropper dialog: the picked image inside a frame shaped like where it will show. */
.cropper {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 24px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
}
.cropper::backdrop { background: rgba(0, 0, 0, .6); }
.cropper h2 { margin: 0 0 4px; }
.cropper p { margin: 0 0 16px; }
.cropper-frame {
  /* Never taller than about half the screen, so the buttons stay in view (a phone held sideways). */
  position: relative; overflow: hidden; width: min(100%, calc(50dvh * var(--aspect, 1))); aspect-ratio: var(--aspect, 1);
  margin: 0 auto; border-radius: 12px; background: #000;
  touch-action: none; user-select: none; cursor: grab;
}
.cropper-frame.is-dragging { cursor: grabbing; }
.cropper-frame:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.cropper-frame img { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
/* The profile photo shows as a circle: dim the corners outside it. */
.cropper-frame.is-round::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .5); outline: 2px solid rgba(255, 255, 255, .8);
}
.cropper-zoom { display: flex; align-items: center; gap: 12px; margin: 16px 0 20px; font-weight: 600; }
.cropper-zoom input { flex: 1; accent-color: var(--primary); }
.cropper-actions { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 480px) {
  .cropper { padding: 16px; }
  .cropper-actions .btn { flex: 1; }
}

/* Color editor popover */
.color-popover {
  position: absolute; right: 0; z-index: 10; width: 288px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--popover-shadow); display: grid; gap: 14px;
}
.color-popover[hidden] { display: none; }
.cp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cp-tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--subtle); }
.cp-tabs button {
  padding: 5px 14px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  font: inherit; font-size: .9rem; font-weight: 700; color: var(--muted);
}
.cp-tabs button[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.cp-tabs button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.cp-panel { display: grid; gap: 16px; }
.cp-panel[hidden] { display: none; }
.cp-section { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.cp-label { margin: 0; font-family: var(--font-body); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* "Default" body swatch: the cream the card uses when no body color is picked. */
.cp-preset-default { background: #fffdf9; }
.cp-section-first { padding-top: 0; border-top: 0; }
.cp-hint { margin: -6px 0 0; font-size: .8rem; color: var(--muted); }
.cp-swatch-body { background: var(--sheet, #fffdf9); }
/* Font choices: each label previews its pairing (the .font-<key> class sets --card-display). */
.cp-fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; border: 0; }
.cp-fonts legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.cp-fonts input { position: absolute; opacity: 0; pointer-events: none; }
.cp-fonts label {
  display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); cursor: pointer;
}
.cp-fonts label:hover { background: var(--surface-hover); }
.cp-fonts input:checked + label { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.cp-fonts input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }
.cp-font-sample { font-family: var(--card-display); font-size: 1.6rem; font-weight: var(--card-name-weight, 600); line-height: 1.2; }
.cp-font-name { font-family: var(--card-font); font-size: .85rem; color: var(--muted); }
.cp-done { font: inherit; font-size: .85rem; font-weight: 600; padding: 4px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: inherit; cursor: pointer; }
.cp-done:hover { background: var(--surface-hover); }
/* Theme choice: two radios styled as a segmented control. */
.cp-presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.cp-preset {
  aspect-ratio: 1; width: 100%; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); transition: transform .1s;
}
.cp-preset:hover { transform: scale(1.1); }
.cp-preset[aria-pressed=true] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.cp-sv {
  position: relative; height: 150px; border-radius: 10px; cursor: crosshair; touch-action: none;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(var(--hue, 0) 100% 50%);
}
.cp-sv:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.cp-thumb {
  position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; pointer-events: none;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 2px 4px rgba(0, 0, 0, .3); background: var(--accent);
}
.cp-hue {
  -webkit-appearance: none; appearance: none; width: 100%; height: 14px; margin: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.cp-hue::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 2px 4px rgba(0, 0, 0, .3); background: hsl(var(--hue, 0) 100% 50%);
}
.cp-hue::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); background: hsl(var(--hue, 0) 100% 50%);
}
.cp-hue:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.cp-hex { display: flex; align-items: center; gap: 10px; }
.cp-hex .swatch { width: 32px; height: 32px; border-radius: 8px; }
.cp-swatch-accent { background: var(--accent); }
.cp-hex input {
  flex: 1; min-width: 0; padding: 7px 10px; font: inherit; font-family: ui-monospace, Consolas, monospace; font-size: .9rem;
  text-transform: lowercase; color: inherit; background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
}
.cp-hex input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.cp-hex input[aria-invalid=true] { border-color: var(--danger); outline-color: var(--danger); }

.canvas input, .canvas textarea {
  display: block; width: 100%; margin: 0; padding: 2px 6px; border: 0; border-radius: 6px;
  font: inherit; color: inherit; text-align: inherit; line-height: inherit;
  /* Always tinted in Edit mode so it's obvious what can be edited; Preview mode clears it. */
  background: var(--field-tint);
}
.canvas {
  --field-tint: color-mix(in srgb, var(--accent) 7%, transparent);
  --field-tint-hover: color-mix(in srgb, var(--accent) 14%, transparent);
}
/* A dark accent barely shows on a dark sheet, so dark card bodies tint with the lightened ink color. */
.canvas.sheet-dark {
  --field-tint: color-mix(in srgb, var(--accent-ink) 14%, transparent);
  --field-tint-hover: color-mix(in srgb, var(--accent-ink) 24%, transparent);
}
.canvas textarea { resize: none; overflow: hidden; }
.canvas input::placeholder, .canvas textarea::placeholder { color: var(--ink-placeholder); opacity: 1; }
.canvas input:hover, .canvas textarea:hover { background: var(--field-tint-hover); }
.canvas input:placeholder-shown, .canvas textarea:placeholder-shown { outline: 1px dashed var(--dashed); outline-offset: -1px; }
.canvas input:focus, .canvas textarea:focus { outline: 2px solid var(--accent-ink); outline-offset: -1px; background: var(--sheet); }
.canvas .errorlist { text-align: left; margin: 4px 0 8px; }

.canvas .avatar { position: relative; padding: 0; font-family: var(--card-display); cursor: pointer; }
.canvas .avatar > * { grid-area: 1 / 1; }
.avatar-hint {
  align-self: end; width: 100%; padding: 4px 0 8px; font-size: .7rem; font-weight: 600;
  background: rgba(0, 0, 0, .45); color: #fff; transition: background-color .15s;
}
.canvas .avatar:hover .avatar-hint, .canvas .avatar:focus-visible .avatar-hint { background: rgba(0, 0, 0, .7); }
.photo-field { margin: 0 0 12px; font-size: .85rem; }

.canvas .role { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; }
.canvas .role input { width: auto; max-width: 100%; }
.canvas .bio { white-space: normal; }
.canvas .save { cursor: default; }

.canvas .list label { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--line); cursor: text; }
.canvas .list li:first-child label { border-top: none; }
/* A business card's company and website: the business's, so shown as text, not fields. */
.canvas .locked-value { padding: 2px 6px; cursor: default; }
.canvas .list .locked-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--line); cursor: default; }
.canvas .list li.locked-row:first-child { border-top: none; }
.canvas .row-text { flex: 1; min-width: 0; }
.canvas .row-text .label { display: block; padding-left: 6px; }
.canvas .row-text .value { display: block; }

.canvas .socials { flex-direction: column; align-items: stretch; }
.canvas .social { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.canvas .social .errorlist { flex-basis: 100%; }
.social-label {
  flex: none; min-width: 96px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--chip-border);
  font-size: .9rem; font-weight: 600; text-align: center; background: var(--sheet);
}
.canvas .social input { flex: 1; min-width: 0; width: auto; font-size: .9rem; text-align: left; }
.social-remove {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--ink-muted); cursor: pointer;
}
.social-remove:hover { background: color-mix(in srgb, #dc2626 12%, transparent); color: #dc2626; }
.social-remove:focus-visible { outline: 2px solid var(--accent-ink); }
.social-remove svg { width: 14px; height: 14px; }
.social-add { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.social-add[hidden] { display: none; }
.social-add-toggle, .social-menu button {
  padding: 7px 14px; border-radius: 999px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.social-add-toggle { border: 1px dashed var(--dashed); background: none; color: var(--ink-muted); }
.social-add-toggle:hover, .social-add-toggle[aria-expanded=true] { border-color: var(--accent-ink); color: var(--accent-ink); }
.social-menu { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.social-menu[hidden] { display: none; }
.social-menu button { border: 1px solid var(--chip-border); background: var(--sheet); color: var(--ink); }
.social-menu button:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
.social-add-toggle:focus-visible, .social-menu button:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* Preview mode: read-only, empty fields hidden, exactly what a visitor sees. */
.is-previewing .canvas input, .is-previewing .canvas textarea { outline: none !important; background: transparent !important; }
.is-previewing .canvas input:placeholder-shown, .is-previewing .canvas textarea:placeholder-shown,
.is-previewing .banner-button, .is-previewing .cover-field, .is-previewing .avatar-hint, .is-previewing .photo-field,
.is-previewing .bio:has(textarea:placeholder-shown),
.is-previewing .role:not(:has(input:not(:placeholder-shown))):not(:has(.locked-value)),
.is-previewing .role:has(input:placeholder-shown) .sep,
.is-previewing .list li:has(input:placeholder-shown),
.is-previewing .social:has(input:placeholder-shown),
.is-previewing .socials:not(:has(input:not(:placeholder-shown))) { display: none; }
.is-previewing .canvas .list label { border-top: none; }
.is-previewing .canvas .list li:not(:has(input:placeholder-shown)) ~ li label { border-top: 1px solid var(--line); }
.is-previewing .canvas .socials { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.is-previewing .canvas .social input, .is-previewing .social-remove, .is-previewing .social-add { display: none; }

.card-settings { margin-top: 24px; }
.slug-field { display: flex; align-items: center; gap: 4px; }
.slug-field input { flex: 1; min-width: 0; }

.footer { text-align: center; color: var(--muted); font-size: .9rem; padding: 32px 0 48px; }

.nfc-reveal { margin-top: 20px; text-align: center; }
.nfc-reveal[hidden] { display: none; }
.nfc-reveal .btn-link { color: var(--danger); opacity: .7; }
.nfc-reveal .btn-link:hover { opacity: 1; }
#nfc-panel { margin-top: 20px; }

.share-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.share-buttons svg { width: 18px; height: 18px; flex: none; }
.share-buttons + .small { margin: 10px 0 18px; }

/* Account settings: a section nav beside a stack of panels. */
.settings-layout { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 8px 14px; border-radius: 10px; color: var(--text); font-weight: 600; text-decoration: none; }
.settings-nav a:hover { background: var(--surface-hover); }
.settings-sections .panel { scroll-margin-top: 24px; }
.settings-value { margin: 0; }
.settings-group + .settings-group { margin-top: 20px; }
.settings-group h3 { margin: 0 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; }
.settings-group:last-of-type { margin-bottom: 18px; }
.settings-row label { display: block; font-weight: 700; margin: 0; cursor: pointer; }
.settings-row .help { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.settings-row .btn { flex: none; }
@media (max-width: 720px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}

.callout { margin: 0 0 20px; padding: 12px 16px; border-radius: 12px; font-size: .9rem; background: color-mix(in srgb, var(--primary) 8%, transparent); border-left: 3px solid var(--primary); }

/* Shop */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nav-cart { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--text); }
.nav-cart:hover { background: var(--surface-hover); }
.nav-cart svg { width: 22px; height: 22px; }
.nav-cart-count { position: absolute; top: -2px; right: -4px; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: .7rem; font-weight: 700; line-height: 1; }
.shop-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 28px; }
.shop-filters a { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem; text-decoration: none; }
.shop-filters a:hover { background: var(--surface-hover); }
.shop-filters a[aria-current=page] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.product-grid > .panel { margin-top: 0; }
.product-tile { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.product-tile:hover { text-decoration: none; transform: translateY(-2px); }
.product-tile h2 { margin: 0; font-size: 1.15rem; }
.product-tile p { margin: 0 0 8px; }
.product-price { margin-top: auto; font-weight: 700; font-size: 1.05rem; }
.product-image { display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: 12px; overflow: hidden; border-radius: 14px; background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-image svg { width: 30%; height: auto; }
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.product-detail > .panel { margin-top: 0; }
.product-image-large { margin: 0; padding: 0; aspect-ratio: 1; }
.product-detail h1 { margin: 4px 0 12px; }
.product-description p { margin: 0 0 12px; }
.variant-picker { border: none; padding: 0; margin: 8px 0 20px; display: grid; gap: 8px; }
.variant-option { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.variant-option:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.variant-option input { accent-color: var(--primary); margin: 0; }
.variant-name { font-weight: 600; }
.variant-price { margin-left: auto; font-weight: 700; }
.add-to-cart-row { display: flex; gap: 12px; }
.qty-input { width: 76px; padding: 9px 12px; font: inherit; color: inherit; border: 1px solid var(--border); border-radius: 12px; background: var(--input-bg); }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.cart-line:first-child { padding-top: 0; }
.cart-thumb { flex: none; width: 64px; margin: 0; }
.cart-thumb svg { width: 50%; }
.cart-item { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cart-qty { display: flex; align-items: center; gap: 8px; margin: 0; }
.cart-qty .btn-secondary { padding: 8px 14px; }
.cart-line-total { min-width: 80px; text-align: right; }
.cart-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-top: 20px; text-align: right; }
.cart-summary p { margin: 0; }
.cart-total { display: flex; justify-content: space-between; gap: 24px; font-size: 1.2rem; }
.order-lines { margin: 20px 0 12px; }
.order-lines + .cart-total { margin-bottom: 20px; }
.order-ship-heading { font-size: 1rem; margin: 0 0 4px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 720px) {
  .product-detail { grid-template-columns: 1fr; }
  .cart-line { flex-wrap: wrap; }
  .cart-qty { order: 3; width: 100%; padding-left: 80px; }
}

/* A radio group drawn as a segmented control (account settings choices like the theme). */
fieldset.settings-row { margin: 0; padding: 14px 0; border: none; border-bottom: 1px solid var(--border); min-width: 0; }
.settings-row legend { float: left; padding: 0; font-weight: 700; }
.settings-row legend + .help { clear: left; }
.segmented { display: inline-flex; flex: none; padding: 3px; border-radius: 999px; background: var(--subtle); box-shadow: inset 0 0 0 1px var(--border); }
.segmented label { position: relative; margin: 0; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 6px 14px; border-radius: 999px; font-size: .875rem; font-weight: 600; white-space: nowrap; }
.segmented input:checked + span { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (max-width: 560px) {
  .settings-choice { flex-direction: column; align-items: flex-start; }
}

/* Your link (personal accounts): the mode switch, and the cards the link can show. The switch shows
   each card's matching control: a radio for "One card", a checkbox and up/down buttons for "Swipe". */
.link-mode { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.link-mode legend { padding: 0; margin-bottom: 6px; font-weight: 700; font-size: .9rem; }
.link-mode .help { display: block; margin-top: 8px; color: var(--muted); font-size: .8rem; }
.link-form:has(input[name="mode"][value="single"]:checked) .carousel-only,
.link-form:has(input[name="mode"][value="carousel"]:checked) .single-only { display: none; }
.link-cards { list-style: none; margin: 0 0 20px; padding: 0; border: 1px solid var(--border); border-radius: 14px; }
.link-card { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.link-card + .link-card { border-top: 1px solid var(--border); }
.link-card-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.link-card-main input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.link-card .tile-avatar { width: 44px; height: 44px; border-width: 2px; font-size: 1rem; box-shadow: none; }
.card-chip-text { display: flex; flex-direction: column; min-width: 0; }
.card-chip-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-card-move { display: flex; gap: 4px; }
.link-card:first-child [data-move="up"], .link-card:last-child [data-move="down"] { visibility: hidden; }
.icon-button {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-button:hover { background: var(--surface-hover); }
.icon-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon-button svg { width: 18px; height: 18px; }

/* Dashboard: a personal account's link, above its cards. */
.link-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.link-summary h2 { margin: 0 0 2px; }
.link-summary .stats { flex: 1; min-width: 240px; margin: 0; }

/* Signup: the plans as selectable boxes, each with its price and what it includes. */
.plan-picker { min-width: 0; padding: 0; border: 0; }
.plan-picker legend { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: .9rem; }
.form-row label.plan {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; margin-bottom: 10px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 14px; font-weight: 500; cursor: pointer;
}
.form-row label.plan:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.plan input { margin: 4px 0 0; accent-color: var(--primary); }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.plan-name { font-weight: 800; }
.plan-price { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.plan-price strong { color: var(--text); font-size: 1.15rem; }
.plan-features { grid-column: 2; margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.signup-next { margin: 4px 0 16px; color: var(--muted); font-size: .85rem; }
.billing-note { margin: 12px 0 0; color: var(--muted); font-size: .8rem; }

/* Dashboard: no active subscription, so the cards are offline. */
.callout-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  margin-bottom: 24px; border-left: 4px solid var(--primary);
}
.callout-panel h2 { margin: 0 0 4px; }
.callout-panel p { margin: 0; }
.billing-heading { margin: 20px 0 8px; font-size: 1rem; }
.invoice-links { white-space: nowrap; text-align: right; }
.invoice-links a + a { margin-left: 12px; }
.cost-notice p { margin: 0 0 10px; }
.cost-notice .form-check { font-weight: 700; }
.cost-notice input { accent-color: var(--primary); }
/* Signup: the business fields only matter for a business account. */
.signup-form:has(input[name="account_type"][value="personal"]:checked) .business-fields { display: none; }
.business-fields > .help { margin: -6px 0 18px; color: var(--muted); font-size: .8rem; }
