/* ------------------------------------------------------------------ Theme */
:root {
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-brand: "Cinzel", "Times New Roman", serif;

  --gold-1: #f3d77a;
  --gold-2: #c9a227;
  --gold-3: #9c7a12;
  --gold-grad: linear-gradient(135deg, #f7e08a 0%, #d4a72c 50%, #a87a12 100%);

  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 68px;
  --footer-h: 40px;
}

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f7f5ee;
  --surface: #ffffff;
  --surface-2: #faf8f2;
  --border: #e6e0cf;
  --text: #121212;
  --text-muted: #5f6b64;
  --purple: #1b5e45;
  --purple-strong: #0f3d2e;
  --purple-soft: rgba(27, 94, 69, 0.1);
  --gold: #b88a12;
  --gold-grad: linear-gradient(135deg, #d9b443 0%, #b88a12 55%, #7d5a08 100%);
  --accent-ring: rgba(201, 162, 39, 0.55);
  --shadow: 0 1px 2px rgba(15, 61, 46, 0.06), 0 8px 28px rgba(15, 61, 46, 0.08);
  --bg-glow: radial-gradient(1200px 600px at 100% -10%, rgba(27, 94, 69, 0.09), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(201, 162, 39, 0.1), transparent 60%);

  /* Canvas colours (read by animation.js) */
  --canvas-fabric: #fdfbf6;
  --canvas-grid: rgba(30, 70, 55, 0.13);
  --canvas-grid-bold: rgba(30, 70, 55, 0.32);
  --canvas-guide: #1b5e45;
  --canvas-select: #c9a227;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c0b;
  --bg-soft: #0f1512;
  --surface: #131c18;
  --surface-2: #17221d;
  --border: #253630;
  --text: #f3efe3;
  --text-muted: #a3ada7;
  --purple: #63c597;
  --purple-strong: #3f9e74;
  --purple-soft: rgba(99, 197, 151, 0.14);
  --gold: #e6c158;
  --gold-grad: linear-gradient(135deg, #f7e08a 0%, #d4a72c 50%, #a87a12 100%);
  --accent-ring: rgba(230, 193, 88, 0.6);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.45);
  --bg-glow: radial-gradient(1200px 600px at 100% -10%, rgba(63, 158, 116, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(201, 162, 39, 0.1), transparent 60%);

  --canvas-fabric: #0d1411;
  --canvas-grid: rgba(215, 235, 225, 0.07);
  --canvas-grid-bold: rgba(215, 235, 225, 0.2);
  --canvas-guide: #8fdcb6;
  --canvas-select: #e6c158;
}

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

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Elements hidden with the hidden attribute stay hidden, whatever their display style. */
[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ Header */
.app-header {
  height: var(--header-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
}

.app-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-2), var(--purple), transparent);
  opacity: 0.55;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  display: block;
  filter: drop-shadow(0 4px 10px rgba(27, 94, 69, 0.35));
  transition: transform 0.4s ease;
}

.brand:hover .brand-logo {
  transform: rotate(-8deg) scale(1.05);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.08em;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--purple);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.coords {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  min-width: 128px;
  text-align: center;
}

/* ------------------------------------------------------------------ Buttons & icons */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.icon-btn:hover {
  border-color: var(--gold-2);
  background: var(--purple-soft);
}

.icon-btn:active {
  transform: scale(0.94);
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg .solid {
  fill: currentColor;
}

svg.dotted path {
  stroke-width: 2.2;
  stroke-dasharray: 0.01 3.2;
}

#theme-toggle .icon-moon {
  display: none;
}

#theme-toggle .icon-sun {
  color: var(--gold);
}

:root[data-theme="dark"] #theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] #theme-toggle .icon-moon {
  display: block;
  color: var(--gold);
}

/* ------------------------------------------------------------------ Layout */
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 290px;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - var(--header-h) - var(--footer-h));
}

/* ------------------------------------------------------------------ Toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow-y: auto;
}

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

.tool-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 44px);
  grid-auto-rows: 44px;
  gap: 6px;
}

/* Flip & rotate act immediately, so they sit apart at the bottom. */
.transform-group {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.edit-group {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.action-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.tools,
.action-btn {
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s;
}

.tools:hover,
.action-btn:hover {
  background: var(--purple-soft);
  color: var(--purple);
}

.action-btn:hover {
  color: var(--gold);
}

.tools:active,
.action-btn:active {
  transform: scale(0.94);
}

.tools.active {
  background: linear-gradient(135deg, var(--purple), var(--purple-strong));
  color: #fff;
  border-color: var(--gold-2);
  box-shadow: 0 0 0 2px var(--accent-ring), 0 6px 16px rgba(27, 94, 69, 0.35);
}

/* ------------------------------------------------------------------ Canvas */
.canvas-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#graph-container {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  background: var(--canvas-fabric);
  scrollbar-color: var(--purple) transparent;
}

#graph-stage {
  flex: none;
  margin: auto;
  position: relative;
}

#graph {
  display: block;
  position: sticky;
  left: 0;
  top: 0;
  touch-action: none;
  cursor: crosshair;
}

.zoom-controls {
  position: absolute;
  right: 18px;
  bottom: 44px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.zoom-controls .icon-btn {
  width: 32px;
  height: 32px;
  border: none;
}

.zoom-controls svg {
  width: 18px;
  height: 18px;
}

.zoom-label {
  min-width: 58px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--purple);
}

.canvas-hint {
  flex: none;
  margin: 0;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ------------------------------------------------------------------ Side panel */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
}

.card {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 12px;
  font-family: var(--font-brand);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

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

.field-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

select,
input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

input.invalid {
  border-color: #d64560;
  box-shadow: 0 0 0 3px rgba(214, 69, 96, 0.15);
}

.input-suffix {
  position: relative;
  display: block;
}

.input-suffix input {
  padding-right: 52px;
}

.input-suffix .suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  pointer-events: none;
}

#stitch-preview {
  display: block;
  width: 72px;
  height: 72px;
  margin: 2px auto 0;
  border-radius: var(--radius-sm);
  background: var(--canvas-fabric);
  border: 1px solid var(--border);
}

#colors-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
}

.colors {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background-color: var(--swatch);
  box-shadow: 0 0 0 1px var(--border), inset 0 -3px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s, box-shadow 0.15s;
}

.colors:hover {
  transform: scale(1.1);
}

.colors.active {
  box-shadow: 0 0 0 2px var(--gold-2), 0 0 0 5px var(--accent-ring);
  transform: scale(1.06);
}

.stats {
  margin: 4px 0 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.stats span {
  font-weight: 600;
  color: var(--text);
}

.primary-btn {
  position: relative;
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-strong) 60%, #0a2e22 100%);
  box-shadow: inset 0 0 0 1px rgba(243, 215, 122, 0.55), 0 8px 22px rgba(27, 94, 69, 0.35);
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}

.primary-btn:hover {
  filter: brightness(1.08);
  box-shadow: inset 0 0 0 1px var(--gold-1), 0 10px 26px rgba(27, 94, 69, 0.45);
}

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

.primary-btn:disabled {
  cursor: progress;
  filter: saturate(0.6);
}

.primary-btn.loading .btn-label::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--gold-1);
  animation: spin 0.8s linear infinite;
}

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

/* ------------------------------------------------------------------ Footer */
.app-footer {
  height: var(--footer-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.app-footer strong {
  margin-left: 0.4em;
  font-family: var(--font-brand);
  letter-spacing: 0.14em;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* "Made by OBBLiT" links to obblit.com */
.made-by {
  text-decoration: none;
  border-radius: 4px;
}

.made-by:hover strong,
.made-by:focus-visible strong {
  filter: brightness(1.2);
  text-decoration: underline;
  text-decoration-color: var(--gold-2);
}

/* ------------------------------------------------------------------ Toast */
.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--header-h) + 14px);
  z-index: 10;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold-2);
  box-shadow: var(--shadow);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity 0.25s, transform 0.25s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-left-color: #d64560;
}

.toast.success {
  border-left-color: var(--purple);
}

.toast-colors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.toast-colors i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
}

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 960px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(420px, 70vh) auto;
    flex: none; /* grow with the content so the footer stays below it */
    height: auto;
    padding: 12px 16px;
  }

  .toolbar {
    flex-direction: row;
    overflow-x: auto;
  }

  .tool-group-label {
    display: none;
  }

  .tool-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 44px;
  }

  .transform-group {
    margin-top: 0;
    padding-top: 0;
    padding-left: 10px;
    border-top: none;
    border-left: 1px solid var(--border);
  }

  .side-panel {
    overflow: visible;
  }

  .coords {
    display: none;
  }
}

/* ------------------------------------------------------------------ Image dialog */
.modal {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(5, 20, 14, 0.45);
}

.modal::backdrop {
  background: rgba(4, 14, 10, 0.55);
  backdrop-filter: blur(3px);
}

.modal[open] {
  animation: modal-in 0.22s ease-out;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.modal-body {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 34px);
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
}

.modal-head {
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 17px;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.modal-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  padding: 20px;
  overflow-y: auto;
}

.image-preview-wrap {
  display: grid;
  place-items: center;
  min-height: 300px;
  border-radius: var(--radius);
  background: var(--canvas-fabric);
  border: 1px solid var(--border);
  padding: 10px;
}

#image-preview {
  display: block;
  max-width: 100%;
  image-rendering: pixelated;
}

.modal-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.color-total {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: var(--purple-soft);
  border: 1px solid var(--border);
}

.color-total-number {
  font-family: var(--font-brand);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.color-total-text {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-muted);
}

.field-label b {
  color: var(--purple);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--purple);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 8px;
  font-size: 13.5px;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--purple);
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.swatch-row i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
}

.ghost-btn {
  height: 42px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-weight: 600;
}

.ghost-btn:hover {
  border-color: var(--gold-2);
}

.modal-primary {
  width: auto;
  height: 42px;
  padding: 0 24px;
}

@media (max-width: 720px) {
  .modal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------------ Header: forum & account */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px 0 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color 0.2s, background 0.2s;
}

#forum-button {
  padding-left: 12px;
}

#forum-button svg {
  color: var(--purple);
}

.pill-btn:hover {
  border-color: var(--gold-2);
  background: var(--purple-soft);
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-strong));
  box-shadow: inset 0 0 0 1.5px var(--gold-2);
}

.avatar svg {
  width: 16px;
  height: 16px;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 20px;
}

.account-wrap {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 180px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.menu button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  text-align: left;
  font-size: 14px;
}

.menu button:hover {
  background: var(--purple-soft);
  color: var(--purple);
}

/* ------------------------------------------------------------------ Shared buttons & lists */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--purple);
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

.secondary-btn:hover:not(:disabled) {
  background: var(--purple);
  color: #fff;
}

.secondary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-row .secondary-btn {
  flex: 1;
}

.ghost-btn.danger:hover {
  border-color: #d64560;
  color: #d64560;
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--purple);
  text-decoration: underline;
}

.card-note,
.field-hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.form-error {
  min-height: 1em;
  margin: 8px 0;
  font-size: 13px;
  color: #d64560;
}

.muted {
  color: var(--text-muted);
  font-size: 12.5px;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.item-info strong,
.item-info .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-info p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.item-grow {
  flex: 1;
  min-width: 0;
}

.list-empty {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.list-heading {
  margin: 4px 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.person-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  text-align: left;
}

.person-btn:hover,
.person-btn.active {
  background: var(--purple-soft);
  border-color: var(--border);
}

.item-list.compact {
  gap: 2px;
  margin-bottom: 14px;
}

/* ------------------------------------------------------------------ Dialog sizes */
.modal-small {
  width: min(440px, calc(100vw - 32px));
}

.modal-wide {
  width: min(1040px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 32px));
}

.auth-body,
.designs-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
}

.designs-body .card-note {
  margin: 0 0 12px;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.modal-head .segmented {
  margin: 0;
  flex-wrap: wrap;
}

.seg {
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.seg.active {
  background: linear-gradient(135deg, var(--purple), var(--purple-strong));
  color: #fff;
}

.soon-badge {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  background: var(--gold-grad);
  color: #2a1d00;
}

/* ------------------------------------------------------------------ Forum */
.forum-body {
  height: 100%;
}

.forum-tab {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.forum-tab[hidden] {
  display: none;
}

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  background: var(--bg-soft);
}

.chat-empty {
  margin: auto;
  color: var(--text-muted);
  font-size: 14px;
}

.msg {
  max-width: min(560px, 80%);
  align-self: flex-start;
}

.msg.mine {
  align-self: flex-end;
}

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 4px 3px;
  font-size: 12px;
  color: var(--text-muted);
}

.msg.mine .msg-meta {
  justify-content: flex-end;
}

.msg-author {
  border: none;
  background: none;
  padding: 0;
  font-weight: 700;
  color: var(--purple);
}

.msg-author:hover {
  text-decoration: underline;
}

.msg-text {
  margin: 0;
  padding: 9px 13px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.45;
}

.msg.mine .msg-text {
  border-radius: 14px 14px 4px 14px;
  border-color: transparent;
  background: linear-gradient(135deg, var(--purple), var(--purple-strong));
  color: #fff;
}

.chat-form {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
}

.send-btn {
  width: auto;
  height: 40px;
  padding: 0 22px;
}

.dm-layout {
  flex-direction: row;
}

.dm-sidebar {
  width: 260px;
  flex: none;
  padding: 14px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.dm-thread {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.people-layout,
.posts-layout {
  gap: 14px;
  padding: 18px 20px;
  overflow-y: auto;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--gold-2);
  background: var(--purple-soft);
}

.profile-card[hidden] {
  display: none;
}

.sign-in-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--gold-2);
  background: color-mix(in srgb, var(--gold-2) 10%, transparent);
  font-size: 14px;
}

.sign-in-note span {
  color: var(--text-muted);
  font-size: 13px;
}

.sign-in-note[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .pill-label {
    display: none;
  }

  .pill-btn {
    padding: 0 6px;
  }

  .modal-head {
    flex-wrap: wrap;
  }

  .dm-layout {
    flex-direction: column;
  }

  .dm-sidebar {
    width: auto;
    max-height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ------------------------------------------------------------------ Forums: picker */
.forum-picker {
  padding: 12px 20px 10px;
  border-bottom: 1px solid var(--border);
}

.forum-picker .muted {
  margin: 8px 2px 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.chip:hover {
  border-color: var(--gold-2);
  color: var(--purple);
}

.chip.active {
  border-color: var(--gold-2);
  background: linear-gradient(135deg, var(--purple), var(--purple-strong));
  color: #fff;
}

/* ------------------------------------------------------------------ Messages: bubbles, files, reactions */
.msg-body {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.msg.mine .msg-body {
  flex-direction: row-reverse;
}

.msg-bubble {
  min-width: 0;
  padding: 9px 13px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.45;
}

.msg.mine .msg-bubble {
  border-radius: 14px 14px 4px 14px;
  border-color: transparent;
  background: linear-gradient(135deg, var(--purple), var(--purple-strong));
  color: #fff;
}

.msg.deleted .msg-bubble {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-style: italic;
}

.msg-bubble .msg-text {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  border-radius: 0;
}

.msg-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.msg-text + .msg-files {
  margin-top: 8px;
}

.msg-image img {
  display: block;
  max-width: min(280px, 100%);
  max-height: 240px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-2);
}

.msg-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, currentColor 8%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

.msg-file-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.msg.mine .msg-file .muted,
.msg.mine .msg-file .link-btn {
  color: rgba(255, 255, 255, 0.85);
}

.msg-more {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 4px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.msg:hover .msg-more,
.msg-more:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .msg-more {
    opacity: 1;
  }
}

.msg-more:hover {
  background: var(--purple-soft);
  color: var(--purple);
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 4px 0;
}

.msg.mine .msg-reactions {
  justify-content: flex-end;
}

.reaction {
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
}

.reaction.mine {
  border-color: var(--gold-2);
  background: var(--purple-soft);
}

.msg-menu {
  position: absolute;
  right: auto;
  z-index: 30;
  min-width: 210px;
}

.msg-menu .danger {
  color: #d64560;
}

.emoji-row {
  display: flex;
  gap: 2px;
  padding: 2px 2px 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.menu .emoji-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  text-align: center;
  font-size: 19px;
  border-radius: 50%;
}

.menu .emoji-btn.active {
  background: var(--purple-soft);
  box-shadow: inset 0 0 0 1.5px var(--gold-2);
}

/* ------------------------------------------------------------------ Composer: attachments */
.chat-form {
  flex-direction: column;
  gap: 8px;
}

.chat-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-form-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.attach-btn {
  flex: none;
}

.attach-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-chip.uploading {
  opacity: 0.6;
}

.file-chip button {
  flex: none;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
}

.file-chip button:hover {
  background: var(--purple-soft);
  color: #d64560;
}

/* ------------------------------------------------------------------ Designs dialog: sharing */
.modal-medium {
  width: min(620px, calc(100vw - 32px));
}

.design-row {
  flex-direction: column;
  align-items: stretch;
}

.design-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.design-row-top .ghost-btn,
.design-row-top .secondary-btn {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.share-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.share-panel[hidden] {
  display: none;
}

.shared-heading {
  margin-top: 18px;
}

.file-row {
  margin-top: 8px;
}

.file-row .ghost-btn {
  flex: 1;
  height: 36px;
  font-size: 13.5px;
}

@media (max-width: 560px) {
  .design-row-top {
    flex-wrap: wrap;
  }

  .design-row-top .item-info {
    flex-basis: 100%;
  }
}

.msg.mine .msg-bubble .msg-text {
  background: none;
  border-radius: 0;
}

/* ------------------------------------------------------------------ My colours + mixer */
#colors-container {
  grid-template-columns: repeat(8, 1fr);
  gap: 7px;
}

.custom-colors-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
}

.custom-colors {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 7px;
}

.add-color {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px dashed var(--gold-2);
  background: conic-gradient(from 0deg, #f33, #ff3, #3f3, #3ff, #33f, #f3f, #f33);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s;
}

.add-color:hover {
  transform: scale(1.1);
}

.color-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px 22px;
}

.sv-area {
  --hue: hsl(300 100% 50%);
  position: relative;
  height: 200px;
  border-radius: var(--radius-sm);
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), var(--hue);
  cursor: crosshair;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.sv-thumb {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hue-range {
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(to right, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00);
}

.hue-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.hue-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.color-result {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.color-result .field {
  flex: 1;
  margin: 0;
}

.color-preview {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--border), inset 0 -4px 8px rgba(0, 0, 0, 0.15);
}

/* ------------------------------------------------------------------ Footer link + feedback */
.app-footer {
  gap: 18px;
}

.footer-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.feedback-intro {
  margin: 0 0 14px;
}

#feedback-text,
.admin-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font: inherit;
  color: inherit;
  resize: vertical;
}

#feedback-text:focus,
.admin-textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}

input[type="email"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.feedback-guest[hidden] {
  display: none;
}

#feedback-attach {
  align-self: flex-start;
  height: 36px;
  font-size: 13.5px;
}

/* ------------------------------------------------------------------ Official (site) messages and posts */
.official-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: 1px;
  background: var(--gold-grad);
  color: #2a1d00;
}

.msg.official .msg-author {
  color: var(--gold);
  cursor: default;
  text-decoration: none;
}

.msg.official .msg-bubble {
  border: 1.5px solid var(--gold-2);
  background: color-mix(in srgb, var(--gold-2) 12%, var(--surface));
  color: var(--text);
}

.item-row.official {
  border-color: var(--gold-2);
  background: color-mix(in srgb, var(--gold-2) 10%, var(--surface-2));
}

@media (max-width: 960px) {
  #colors-container,
  .custom-colors {
    grid-template-columns: repeat(10, 1fr);
  }
}


/* ------------------------------------------------------------------ Accounts: names & profile pictures */
.name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.name-row[hidden],
.signup-only[hidden] {
  display: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-xl {
  width: 72px;
  height: 72px;
  font-size: 28px;
}

.avatar-editor {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.unverified-badge {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  border: 1px solid var(--gold-2);
}

.unverified-badge[hidden] {
  display: none;
}

input[type="email"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font: inherit;
  color: inherit;
}

/* ------------------------------------------------------------------ Notifications */
.bell-btn {
  position: relative;
}

.bell-count {
  position: absolute;
  top: -3px;
  right: -3px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d64560;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--bg);
}

.bell-count[hidden] {
  display: none;
}

.bell-panel {
  width: min(380px, calc(100vw - 24px));
  padding: 0;
  overflow: hidden;
}

.bell-head,
.bell-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}

.bell-head {
  border-bottom: 1px solid var(--border);
}

.bell-foot {
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.bell-foot .check {
  margin: 0;
}

.bell-list {
  max-height: min(60vh, 440px);
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
}

.note-row {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 10px;
}

.note-row.unread {
  background: var(--purple-soft);
}

.menu .note-open {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 8px;
}

.note-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--text);
}

.note-row.unread .note-text {
  font-weight: 600;
}

.note-icon {
  font-size: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1.5px var(--border);
}

.menu .note-remove {
  width: 30px;
  flex: none;
  padding: 6px 0;
  text-align: center;
  color: var(--text-muted);
}

.bell-more {
  display: block;
  margin: 0 auto 8px;
}

.post-card.highlight {
  box-shadow: 0 0 0 2px var(--gold-2);
}

.notify-set {
  margin-top: 10px;
}

/* ------------------------------------------------------------------ Posts */
.post-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.post-composer[hidden] {
  display: none;
}

.post-composer textarea,
.post-edit textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font: inherit;
  color: inherit;
  resize: vertical;
}

.post-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
}

.post-options .check {
  margin: 0;
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.field-inline select {
  height: 34px;
  width: auto;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-actions .ghost-btn {
  height: 38px;
  padding: 0 14px;
  font-size: 13.5px;
}

.post-actions .primary-btn {
  width: auto;
  margin-left: auto;
  padding: 0 24px;
}

.post-design-attach,
.post-design {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.post-design-attach[hidden] {
  display: none;
}

.design-preview {
  flex: none;
  width: 160px;
  height: 110px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.post-design .design-preview {
  width: 220px;
  height: 150px;
}

.posts-filter {
  font-size: 14px;
  color: var(--text-muted);
}

.posts-filter[hidden] {
  display: none;
}

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

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.post-card.official {
  border-color: var(--gold-2);
  background: color-mix(in srgb, var(--gold-2) 7%, var(--surface));
}

.post-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  color: inherit;
  min-width: 0;
}

.post-author:disabled {
  cursor: default;
}

.post-author .avatar {
  width: 38px;
  height: 38px;
  font-size: 16px;
}

.post-head .post-author {
  flex: 1;
}

.post-more {
  position: static;
  opacity: 1;
}

.post-title {
  margin: 0;
  font-size: 17px;
}

.post-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.post-media {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
}

.post-media.count-1 {
  grid-template-columns: 1fr;
}

.post-media-item {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.post-media-item img,
.post-media-item video {
  display: block;
  max-width: 100%;
  max-height: 420px;
  margin: 0 auto;
  object-fit: contain;
}

.post-media-item video {
  width: 100%;
}

.media-download {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 15px;
}

.post-hidden-media {
  margin: 0;
  font-size: 13px;
}

.post-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.post-foot .msg-reactions {
  margin: 0;
}

.small-btn {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.post-comments {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.post-comments[hidden] {
  display: none;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.comment .post-author .avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.comment-body {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.comment-body .msg-text {
  margin: 2px 0 0;
}

.comment-actions {
  display: flex;
  gap: 12px;
  font-size: 12.5px;
}

.post-edit,
.report-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--gold-2);
}

.load-more {
  align-self: center;
}

.load-more[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .post-design,
  .post-design-attach {
    flex-direction: column;
    align-items: stretch;
  }

  .design-preview,
  .post-design .design-preview {
    width: 100%;
  }
}

#settings-form .field-hint {
  margin: -4px 0 14px;
}

/* ------------------------------------------------------------------ Forum boards (discussions) */
.boards {
  padding: 18px 20px;
  overflow-y: auto;
}

#boards-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.board-title {
  margin: 0;
  font-size: 18px;
}

.board-head p {
  margin: 4px 0 0;
  font-size: 13.5px;
}

.board-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.board-start {
  width: auto;
  height: 40px;
  padding: 0 18px;
  flex: none;
}

.board-back {
  align-self: flex-start;
  margin-bottom: 6px;
}

.board-search {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.board-search input {
  flex: 1;
  max-width: 340px;
}

.board-list,
.card-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.forum-row,
.thread-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  color: inherit;
  text-align: left;
}

.forum-row:last-child,
.thread-row:last-child {
  border-bottom: none;
}

.forum-row:hover,
.thread-row:hover {
  background: var(--purple-soft);
}

.forum-row .item-info strong {
  font-size: 15.5px;
}

.forum-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 22px;
  background: color-mix(in srgb, var(--gold-2) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold-2) 45%, transparent);
}

.forum-stats,
.thread-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: none;
  gap: 2px;
  font-size: 12.5px;
  white-space: nowrap;
}

.forum-stats span:first-child {
  font-weight: 700;
  color: var(--text);
}

.thread-row .avatar {
  width: 36px;
  height: 36px;
}

.grow {
  flex: 1;
  min-width: 0;
}

.card-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.new-thread {
  border-color: var(--gold-2);
}

.new-thread textarea,
.reply-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font: inherit;
  color: inherit;
  resize: vertical;
}

.reply-form textarea {
  min-height: 42px;
}

.board-byline .post-author .avatar {
  width: 38px;
  height: 38px;
}

.thread-files {
  margin-top: 4px;
}

.reply-count {
  margin: 8px 0 0;
  font-size: 15px;
}

.thread-replies {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

@media (max-width: 560px) {
  .forum-stats {
    display: none;
  }

  .board-title-row {
    flex-direction: column;
  }
}

/* Post reactions: stats line, then a button per reaction with its count. */
.post-foot {
  display: block;
}

.post-stats {
  display: flex;
  justify-content: space-between;
  padding: 2px 2px 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.react-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--text);
  font-size: 14px;
}

.react-btn:hover {
  background: var(--purple-soft);
}

.react-btn.mine {
  border-color: var(--gold-2);
  background: color-mix(in srgb, var(--gold-2) 14%, transparent);
}

.react-btn .n {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Notifications: a picture with the kind of notification on its corner, bold name, time, unread dot. */
.bell-panel .bell-head .ghost-btn {
  height: 30px;
}

.bell-see-all {
  display: block;
  width: 100%;
  padding: 11px;
  border: none;
  border-top: 1px solid var(--border);
  background: none;
  font-weight: 600;
  color: var(--purple);
}

.bell-see-all:hover {
  background: var(--purple-soft);
}

.note-row {
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.note-row:last-child {
  border-bottom: none;
}

.note-row.unread {
  background: color-mix(in srgb, var(--gold-2) 10%, transparent);
}

.note-open,
.menu .note-open {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
  padding: 11px 10px;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
}

.note-open:hover {
  background: var(--purple-soft);
}

.note-pic {
  position: relative;
  flex: none;
}

.note-pic .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.note-type {
  position: absolute;
  right: -5px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  background: var(--surface);
  box-shadow: 0 0 0 1.5px var(--border);
}

.note-site {
  color: var(--gold-1);
}

.note-text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.note-time {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.note-dot {
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--gold-2);
}

.note-remove,
.menu .note-remove {
  flex: none;
  width: 38px;
  border: none;
  background: none;
  color: var(--text-muted);
}

.note-remove:hover {
  color: #d64560;
}

.notes-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.notes-tabs {
  align-self: flex-start;
}

.notes-list {
  max-height: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}

.notes-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

#notes-dialog .modal-head .btn-row {
  margin-left: auto;
}

.comment-body .msg-text {
  padding: 0;
  border: none;
  background: none;
}

.note-row.unread .note-text {
  font-weight: 400;
}

.note-text strong {
  font-weight: 700;
}

/* ================================================================== Tailors' Atelier pages */

/* ---------------------------------------------------------------- Header & top menu */
.app-header {
  gap: 18px;
}

.brand-name {
  font-size: 21px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.brand-sub {
  letter-spacing: 0.22em;
  white-space: nowrap;
}

.site-nav {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  flex: none;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.site-nav a:hover {
  color: var(--purple);
  background: var(--purple-soft);
}

.site-nav a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-strong));
  box-shadow: inset 0 0 0 1px var(--gold-2);
}

.site-nav a.nav-css {
  border: 1px dashed var(--gold-2);
  color: var(--gold);
}

.site-nav a.nav-css.active {
  color: #fff;
  border-style: solid;
}

.menu-toggle {
  display: none;
}

/* The coordinates only mean something on the drawing canvas. */
body:not([data-view="cross-stitch"]) .coords {
  display: none;
}

@media (max-width: 1180px) {
  .menu-toggle {
    display: inline-grid;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: calc(var(--header-h) - 4px);
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    width: min(280px, calc(100vw - 24px));
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: visible;
    z-index: 20;
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 560px) {
  .brand-sub {
    display: none;
  }

  .brand-name {
    font-size: 17px;
  }

  .app-header {
    padding: 0 12px;
    gap: 8px;
  }

  .header-actions {
    gap: 6px;
  }

  #account-label {
    display: none;
  }
}

/* ---------------------------------------------------------------- Pages */
.views {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view[hidden] {
  display: none !important;
}

.page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 26px;
  letter-spacing: 0.03em;
  color: var(--text);
}

.page-sub {
  margin: 6px 0 0;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.page-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.page-side {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.2s;
}

.side-card:hover {
  border-color: var(--gold-2);
  transform: translateY(-1px);
}

.side-card > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

.side-card strong {
  font-size: 15px;
}

.side-icon {
  font-size: 26px;
  width: 48px;
  text-align: center;
}

.cross-stitch-card {
  border-color: var(--gold-2);
  background: linear-gradient(135deg, var(--purple-soft), transparent);
}

@media (max-width: 900px) {
  .page-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-side {
    position: static;
    order: -1;
    flex-direction: row;
    overflow-x: auto;
  }

  .side-card {
    flex: 0 0 240px;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 16px 16px 32px;
  }

  .page-title {
    font-size: 21px;
  }
}

/* ---------------------------------------------------------------- Hero */
.hero {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 26px;
  border-radius: 20px;
  border: 1px solid var(--gold-2);
  color: #fff;
  background: radial-gradient(600px 300px at 90% 0%, rgba(201, 162, 39, 0.25), transparent 60%), linear-gradient(135deg, #0f3d2e, #0a2e22 60%, #123f30);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 3.2vw, 32px);
  line-height: 1.2;
}

.hero h1 span {
  color: var(--gold-1);
}

.hero p {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.85);
  max-width: 640px;
}

.hero .ghost-btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.hero-logo {
  flex: none;
}

.hero-search {
  display: flex;
  gap: 8px;
  max-width: 560px;
}

.hero-search input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.95);
  color: #121212;
}

.hero-search .primary-btn {
  width: auto;
  padding: 0 22px;
}

@media (max-width: 640px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
  }

  .hero-logo {
    width: 56px;
    height: 56px;
  }
}

/* ---------------------------------------------------------------- The Cross Stitch Studio page */
.workspace.view {
  grid-template-rows: auto minmax(0, 1fr);
}

.section-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
}

.section-banner strong {
  font-family: var(--font-brand);
  letter-spacing: 0.06em;
  color: var(--gold);
  font-size: 15px;
}

@media (max-width: 960px) {
  .workspace.view {
    grid-template-rows: auto auto minmax(420px, 70vh) auto;
  }
}

/* ---------------------------------------------------------------- Messages & people as pages */
.page .dm-layout {
  display: flex;
  height: max(460px, calc(100vh - var(--header-h) - var(--footer-h) - 140px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.page .posts-layout {
  padding: 0;
  overflow: visible;
}

.page.people-layout {
  padding: 26px 20px 40px;
  overflow: visible;
}

.page.boards {
  gap: 12px;
}

@media (max-width: 720px) {
  .page .dm-layout {
    flex-direction: column;
    height: auto;
  }

  .page .dm-sidebar {
    width: auto;
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .page .dm-thread {
    height: 70vh;
  }
}

.profile-name {
  font-size: 18px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.profile-bio {
  margin: 6px 0 4px;
  white-space: pre-wrap;
}

.profile-card {
  flex-wrap: wrap;
  align-items: flex-start;
}

.profile-card .item-info {
  flex: 1;
  min-width: 220px;
}

/* ---------------------------------------------------------------- Badges, chips, notes */
.type-badge,
.audience-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}

.type-badge {
  background: var(--purple-soft);
  color: var(--purple);
  border: 1px solid color-mix(in srgb, var(--purple) 30%, transparent);
}

.type-badge.client,
.type-badge.admin {
  background: rgba(201, 162, 39, 0.14);
  color: var(--gold);
  border-color: rgba(201, 162, 39, 0.4);
}

.audience-badge {
  background: rgba(201, 162, 39, 0.14);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0;
}

.status-badge {
  text-transform: capitalize;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.status-pending,
.status-sent {
  color: var(--gold);
  border-color: rgba(201, 162, 39, 0.5);
  background: rgba(201, 162, 39, 0.1);
}

.status-accepted,
.status-paid,
.status-completed {
  color: var(--purple);
  border-color: color-mix(in srgb, var(--purple) 40%, transparent);
  background: var(--purple-soft);
}

.status-declined,
.status-cancelled {
  color: #d64560;
  border-color: rgba(214, 69, 96, 0.4);
  background: rgba(214, 69, 96, 0.08);
}

span.chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  font-size: 12px;
  cursor: default;
}

span.chip.faint {
  background: transparent;
}

.note-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: rgba(201, 162, 39, 0.1);
  font-size: 14px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty-state .big {
  font-size: 40px;
}

.empty-state h2 {
  margin: 4px 0;
}

.empty-state p {
  margin: 0;
  max-width: 520px;
}

.btn-row.center {
  justify-content: center;
}

.btn-row.end {
  justify-content: flex-end;
  margin-top: 12px;
}

.btn-row.nowrap {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.pre {
  white-space: pre-wrap;
  margin: 0;
}

.small {
  font-size: 12.5px;
}

.faint {
  color: #777;
}

.grow {
  flex: 1;
}

a.secondary-btn,
a.ghost-btn,
a.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* ---------------------------------------------------------------- Sign up: tailor or client */
.type-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 6px;
}

.type-pick label {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 12px 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13px;
}

.type-pick label strong {
  font-size: 14px;
}

.type-pick input {
  position: absolute;
  left: 12px;
  top: 14px;
  accent-color: var(--purple);
}

.type-pick label:has(input:checked) {
  border-color: var(--gold-2);
  background: var(--purple-soft);
  box-shadow: inset 0 0 0 1px var(--gold-2);
}

@media (max-width: 480px) {
  .type-pick {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------- Find a Tailor */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.people-grid > .empty-state,
.people-grid > .chat-empty {
  grid-column: 1 / -1;
}

.person-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.person-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
}

.person-bio {
  margin: 0;
  font-size: 14px;
}

.person-actions {
  margin-top: auto;
}

.person-actions .primary-btn,
.person-actions .secondary-btn {
  width: auto;
  flex: 1;
}

/* ---------------------------------------------------------------- Studio tools */
.page-tabs {
  align-self: flex-start;
}

.tab-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.list-bar .primary-btn {
  width: auto;
  padding: 0 18px;
}

.tab-body .card-list,
.page .card-list {
  border: none;
  background: none;
  gap: 12px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title-row h3 {
  margin: 0;
}

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

.measure-grid.edit {
  gap: 4px 12px;
}

.measure-grid.edit .field {
  margin: 0;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

.kv span {
  color: var(--text-muted);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 12px;
}

@media (max-width: 640px) {
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.item-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.invoice-line {
  grid-template-columns: minmax(0, 1fr) 80px 120px 36px;
}

.item-line input {
  min-width: 0;
}

.invoice-total {
  font-size: 18px;
}

.table-wrap {
  overflow-x: auto;
  padding: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.data-table .num,
.invoice-doc .num {
  text-align: right;
}

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

.style-card {
  padding: 0;
  overflow: hidden;
}

.style-card img,
.style-card .noimg {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 44px;
  background: var(--surface-2);
}

.style-card img {
  cursor: zoom-in;
}

.style-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 14px;
}

.lightbox-img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

.ui-modal-body {
  overflow-y: auto;
}

.ui-modal-body > :not(form) {
  margin: 16px 20px;
}

.modal-large {
  width: min(980px, calc(100vw - 32px));
}

.auth-body h3 {
  margin: 12px 0 6px;
  font-size: 15px;
}

/* An invoice, as printed */
.invoice-doc {
  padding: 28px;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #111;
  font-size: 14px;
}

.invoice-doc .inv-head,
.invoice-doc .inv-parties {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.invoice-doc .inv-head {
  padding-bottom: 14px;
  border-bottom: 3px solid #c9a227;
}

.invoice-doc h1 {
  margin: 6px 0 0;
  color: #0f3d2e;
  font-family: Georgia, serif;
  letter-spacing: 0.1em;
}

.invoice-doc .right {
  text-align: right;
}

.invoice-doc table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-doc th {
  background: #0f3d2e;
  color: #fff;
  text-align: left;
  padding: 8px 10px;
}

.invoice-doc td {
  padding: 8px 10px;
  border-bottom: 1px solid #e6e0cf;
}

.invoice-doc .totals {
  margin-left: auto;
  width: min(300px, 100%);
  margin-top: 12px;
}

.invoice-doc .totals div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.invoice-doc .totals .grand {
  border-top: 2px solid #0f3d2e;
  margin-top: 4px;
  padding-top: 8px;
  font-weight: 700;
  font-size: 17px;
}

.invoice-doc .inv-notes {
  margin-top: 18px;
  color: #444;
}

.invoice-doc .inv-thanks {
  margin-top: 26px;
  text-align: center;
  color: #9c7414;
}

#print-area {
  display: none;
}

@media print {
  body.printing > *:not(#print-area) {
    display: none !important;
  }

  body.printing #print-area {
    display: block;
  }

  body.printing {
    background: #fff;
  }

  body.printing .invoice-doc {
    padding: 0;
  }
}

/* ---------------------------------------------------------------- Requests */
.request-card .facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
}

/* ---------------------------------------------------------------- Stickers */
.maker {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.maker-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.sticker-canvas {
  width: 260px;
  height: 260px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 24px 24px;
}

@media (max-width: 720px) {
  .maker {
    grid-template-columns: minmax(0, 1fr);
  }
}

.emoji-row.wrap {
  flex-wrap: wrap;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.swatches button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.swatches button.active {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 2px var(--gold-2);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.sticker-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.sticker-tile img {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

.sticker-tile .nm {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.sticker-tile .x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px;
}

.sticker-pick {
  display: grid;
  grid-template-columns: repeat(4, 56px);
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}

.sticker-pick button {
  padding: 2px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
}

.sticker-pick button:hover {
  border-color: var(--gold-2);
  background: var(--purple-soft);
}

.sticker-pick img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.sticker-empty {
  margin: 6px 10px;
}

.comment-sticker {
  display: block;
  width: 110px;
  height: 110px;
  object-fit: contain;
  margin: 4px 0;
}

.sticker-btn {
  flex: none;
  width: 40px;
  height: 40px;
  font-size: 17px;
}

.msg-menu {
  position: fixed;
  z-index: 50;
}

.footer-brand {
  font-family: var(--font-brand);
  color: var(--gold);
  letter-spacing: 0.04em;
}

.hero .btn-row > *,
.empty-state .btn-row > * {
  width: auto;
  padding: 0 20px;
}

.btn-row.end > *,
.list-bar .primary-btn {
  width: auto;
}

.person-actions .primary-btn,
.person-actions .secondary-btn {
  white-space: nowrap;
  padding: 0 12px;
}

/* Pages are taller than the window; only the canvas page fits it exactly. */
html,
body {
  height: auto;
}

/* The canvas page fills the window between the header and footer (flex-basis would ignore its height). */
.workspace.view {
  flex: none;
  height: calc(100vh - var(--header-h) - var(--footer-h));
}

@media (max-width: 960px) {
  .workspace.view {
    height: auto;
  }
}

.card-box .btn-row > .primary-btn,
.card-box .btn-row > .secondary-btn {
  width: auto;
  padding: 0 16px;
}

.page a:not([class]),
.modal a:not([class]) {
  color: var(--purple);
}

@media (max-width: 480px) {
  .brand-text {
    display: none;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }
}

/* ================================================================== Announcements, awards, reviews */

/* A thin banner under the header for active announcements */
.announcement-banner {
  display: flex;
  flex-direction: column;
  background: linear-gradient(90deg, #0f3d2e, #1b5e45);
  color: #fff;
  border-bottom: 1px solid var(--gold-2);
}

.banner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 16px;
  font-size: 13.5px;
}

.banner-row + .banner-row {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.banner-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

.banner-text strong {
  color: var(--gold-1);
}

.banner-close {
  flex: none;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
}

/* Pinned at the top of the feed */
.post-card.pinned {
  border: 1px solid var(--gold-2);
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.12), var(--surface) 55%);
}

.pinned-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

.award-main {
  display: flex;
  gap: 14px;
  align-items: center;
}

.award-big {
  font-size: 54px;
  line-height: 1;
}

.award-card .post-author {
  margin-top: 4px;
}

/* Stars, reviews and completed business */
.stars {
  color: var(--gold);
  letter-spacing: 1px;
}

.rating-line {
  font-size: 13px;
  color: var(--text-muted);
}

.completed-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--gold-2);
  background: var(--surface-2);
}

.completed-box select {
  width: auto;
}

.review {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
}

.review + .review {
  border-top: 1px solid var(--border);
}

.review-head {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}

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

.review-form .secondary-btn {
  align-self: flex-start;
  width: auto;
  padding: 0 16px;
}

.star-input {
  display: flex;
  gap: 2px;
}

.star-input button {
  border: none;
  background: none;
  padding: 0 2px;
  font-size: 26px;
  line-height: 1;
  color: var(--gold);
}

/* Profile extras */
.profile-extras {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.profile-section h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.award-row,
.history-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
}

.history-row {
  flex-direction: column;
  gap: 2px;
}

.award-row + .award-row,
.history-row + .history-row {
  border-top: 1px solid var(--border);
}

.award-icon {
  font-size: 30px;
  line-height: 1;
}

/* Cropping a profile picture */
.cropper {
  align-items: center;
}

.crop-frame {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
}

.crop-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.45);
  border: 2px solid var(--gold-2);
  pointer-events: none;
}

.crop-canvas {
  width: 280px;
  height: 280px;
  touch-action: none;
  cursor: grab;
  display: block;
}

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

textarea {
  font: inherit;
}

/* ================================================================== Small screens (phones) */

/* Buttons grow to fit their words instead of letting them spill out: each keeps its usual height as a
   minimum, and long labels wrap inside it. */
.primary-btn,
.ghost-btn,
.secondary-btn,
.modal-primary,
.small-btn {
  height: auto;
  max-width: 100%;
  padding-top: 6px;
  padding-bottom: 6px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
}

.primary-btn {
  min-height: 46px;
}

.ghost-btn,
.modal-primary {
  min-height: 42px;
}

.secondary-btn {
  min-height: 36px;
}

.small-btn {
  min-height: 32px;
}

/* Long words and links break inside their card rather than pushing out of it. */
.page h1,
.page h2,
.page h3,
.page p,
.page li,
.card-box,
.post-card,
.modal,
.menu {
  overflow-wrap: break-word;
}

.page img,
.page video,
.modal img,
.modal video {
  max-width: 100%;
}

/* Rows with a title and buttons: the title takes what's left and the buttons drop below if needed. */
.card-title-row {
  flex-wrap: wrap;
}

.card-title-row > :first-child {
  flex: 1 1 160px;
  min-width: 0;
}

.card-title-row .btn-row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* The site menu scrolls inside itself on short screens. */
@media (max-width: 1180px) {
  .site-nav {
    max-height: calc(100vh - var(--header-h) - 16px);
    max-height: calc(100dvh - var(--header-h) - 16px);
    overflow-y: auto;
  }
}

@media (max-width: 720px) {
  /* Footer: wraps onto two centred lines instead of running off both edges. */
  .app-footer {
    height: auto;
    min-height: var(--footer-h);
    flex-wrap: wrap;
    gap: 4px 14px;
    padding: 10px 16px;
    text-align: center;
    letter-spacing: 0.02em;
    line-height: 1.5;
  }
}

@media (max-width: 560px) {
  /* Pop-ups from the header (notifications, account) sit inside the screen, edge to edge. */
  .app-header .menu,
  .site-nav {
    position: fixed;
    top: calc(var(--header-h) + 4px);
    left: 12px;
    right: 12px;
    width: auto;
    min-width: 0;
    max-height: calc(100vh - var(--header-h) - 16px);
    max-height: calc(100dvh - var(--header-h) - 16px);
    overflow-y: auto;
    z-index: 40;
  }

  /* Feed shortcuts: three small tiles that fit the width instead of a strip cut off at the edge. */
  .page-side {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }

  .side-card {
    flex-direction: column;
    gap: 6px;
    padding: 10px 6px;
    text-align: center;
  }

  .side-card img,
  .side-card .side-icon {
    width: 32px;
    height: 32px;
    font-size: 22px;
    line-height: 32px;
  }

  .side-card > span:last-child {
    align-items: center;
  }

  .side-card strong {
    font-size: 12.5px;
    line-height: 1.25;
  }

  .side-card .muted {
    display: none;
  }

  /* Post composer: the "Who can see it" label sits above its list. */
  .post-options .field-inline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
  }

  .post-options .field-inline select {
    width: 100%;
  }

  .post-actions {
    flex-wrap: wrap;
  }

  /* People lists: the name gets the whole line, and Follow / Message sit underneath. */
  .person-item {
    flex-wrap: wrap;
  }

  .person-item > .item-grow {
    flex: 1 1 100%;
  }

  .person-item > button {
    flex: 1 1 0;
  }

  /* Forum and list descriptions show two lines instead of being cut short. */
  .item-info .muted {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  /* Tabs (Studio, Requests, dialogs) wrap onto more lines instead of running off the screen. */
  .segmented,
  .page-tabs {
    flex-wrap: wrap;
    max-width: 100%;
    height: auto;
    border-radius: 16px;
  }

  .segmented button,
  .page-tabs button {
    flex: 1 1 auto;
    height: auto;
    min-height: 34px;
    white-space: normal;
  }

  /* Cross Stitch Studio: all the tools wrap inside the toolbar, so none are hidden past its edge. */
  .toolbar {
    flex-wrap: wrap;
    overflow: visible;
    gap: 8px;
  }

  .tool-grid {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, 40px);
    grid-auto-rows: 40px;
    grid-auto-columns: auto;
  }

  .tool-group {
    flex: 1 1 100%;
  }

  .transform-group,
  .edit-group {
    padding-left: 0;
    border-left: none;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  /* Dialogs use the whole width of the phone. */
  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }
}

/* The sticker canvas shrinks with a narrow phone (it keeps its square shape). */
.sticker-canvas {
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
}

@media (max-width: 560px) {
  .person-item > button {
    min-height: 38px;
  }
}

@media (max-width: 420px) {
  /* Meet a Tailor / Meet Customers: the search box gets the full width, the button goes under it. */
  .hero-search {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-search input {
    flex: none;
  }

  .hero-search .primary-btn {
    width: 100%;
  }
}

@media (max-width: 560px) {
  /* Discussion titles in a forum show in full (up to two lines). */
  .forum-row .item-info strong,
  .thread-row .item-info strong {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* Clients without the Cross Stitch Studio don't see the links and buttons into it. */
body[data-studio="off"] .needs-studio {
  display: none !important;
}

/* Gender choice: two short options side by side. */
.gender-pick label {
  justify-content: center;
  min-height: 42px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.gender-pick input {
  top: 50%;
  transform: translateY(-50%);
}

.gender-tag {
  white-space: nowrap;
}

/* What the selected stitches' layers are (under the Layers list in the studio). */
.layer-selection {
  display: block;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--purple-soft);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.4;
}

.layer-selection[hidden] {
  display: none;
}

.layer-selection.mixed {
  background: rgba(212, 175, 55, 0.16);
  border: 1px solid var(--gold-2);
}

#layer-select.is-mixed {
  border-color: var(--gold-2);
}

/* ---------------------------------------------------------------- How to use Cross Stitch Studio */
.guide-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--gold-2);
  background: linear-gradient(135deg, var(--purple-soft), transparent);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.guide-btn:hover {
  background: var(--purple-soft);
  transform: translateY(-1px);
}

.guide-btn svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.guide-btn svg .solid {
  fill: var(--gold);
  stroke: none;
}

.guide-modal {
  width: min(920px, calc(100vw - 24px));
  height: min(88vh, 960px);
}

.guide-modal .modal-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
}

.guide-modal .modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.guide-modal iframe {
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 0 0 18px 18px;
  background: var(--bg);
}

@media (max-width: 560px) {
  .guide-btn {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .guide-modal {
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    max-height: none;
  }
}

/* ================================================================== Feed tabs, replies, viewer */
.feed-tabs {
  align-self: flex-start;
  margin-bottom: 4px;
}

.feed-tabs[hidden] {
  display: none;
}

/* A quote of the message being answered (in chats and discussions). */
.reply-quote {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 6px;
  padding: 5px 10px;
  border-left: 3px solid var(--gold-2);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-2) 75%, transparent);
  font-size: 12.5px;
  cursor: pointer;
  overflow: hidden;
}

.reply-quote span {
  color: var(--text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.reply-bar[hidden] {
  display: none;
}

.reply-bar .reply-quote {
  flex: 1;
  margin: 0;
  cursor: default;
}

.msg.flash .msg-bubble,
.comment.flash {
  box-shadow: 0 0 0 2px var(--gold-2);
  transition: box-shadow 0.3s;
}

.list-heading {
  list-style: none;
  padding: 4px 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.note-mute {
  font-size: 14px;
}

.post-media-item img.zoomable {
  cursor: zoom-in;
}

.media-expand {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
}

/* Full-screen viewer (viewer.js) */
.media-viewer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(5, 10, 8, 0.96);
  color: #fff;
}

.media-viewer::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.viewer-bar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(rgba(0, 0, 0, 0.6), transparent);
}

.viewer-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.viewer-btn,
.viewer-nav {
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

.viewer-btn {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.viewer-btn[hidden],
.viewer-nav[hidden] {
  display: none;
}

.viewer-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 60px 12px 20px;
}

.viewer-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

iframe.viewer-media {
  width: min(1000px, 100%);
  height: 100%;
  border: none;
  background: #fff;
  border-radius: 6px;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  font-size: 30px;
  line-height: 1;
}

.viewer-prev {
  left: 12px;
}

.viewer-next {
  right: 12px;
}

/* Who sees a style (My Studio → Styles), and styles on a tailor's profile */
.style-who {
  align-self: flex-start;
  font-size: 12.5px;
  text-align: left;
}

.profile-styles {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* ------------------------------------------------------------------ Donations (donate.js) */
.donate-btn {
  display: none;
  padding: 0 14px 0 10px;
  border-color: var(--gold-2);
  white-space: nowrap;
}

.donate-btn .pill-label {
  display: inline;
}

body[data-view="feed"] .donate-btn,
body[data-view="cross-stitch"] .donate-btn {
  display: inline-flex;
}

/* Room for the Donate button in the header */
@media (max-width: 720px) {
  body[data-view="feed"] .brand-sub,
  body[data-view="cross-stitch"] .brand-sub {
    display: none;
  }
}

@media (max-width: 420px) {
  .donate-btn {
    padding: 0 10px;
  }
  .donate-btn .pill-label {
    display: none;
  }
}

.donate {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.donate-intro {
  margin: 0;
  line-height: 1.5;
}

.donate-tabs {
  align-self: flex-start;
}

.donate-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.donate-pane[hidden] {
  display: none;
}

.donate-amount {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
}

.donate-quick,
.donate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.donate-chips .chip.coin {
  height: auto;
  min-height: 32px;
  padding: 4px 12px;
}

.donate-chips .chip.coin span {
  font-weight: 500;
  opacity: 0.8;
}

.donate-address {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.donate-warning {
  align-self: stretch;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  background: rgba(201, 162, 39, 0.15);
  border: 1px solid var(--gold-2);
}

.donate-qr {
  padding: 8px;
  border-radius: 10px;
  background: #fff;
  line-height: 0;
}

.donate-qr img,
.donate-qr canvas {
  width: 168px;
  height: 168px;
}

.donate-addr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: stretch;
  min-width: 0;
}

.donate-addr {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  overflow-wrap: anywhere;
  user-select: all;
}

.donate-thanks {
  font-size: 15px;
  line-height: 1.5;
}

/* Location in Profile & settings (places.js) */
.place-set {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 0;
}

.place-set legend {
  padding: 0 6px;
}

.place-locate {
  align-self: flex-start;
}

.place-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.place-grid select {
  width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .place-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.profile-address {
  overflow-wrap: anywhere;
}

/* Prices (My Studio → Prices, and on a tailor's profile) */
.price-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-line {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 8px;
  align-items: center;
}

.discount-line {
  grid-template-columns: minmax(0, 2fr) minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.2fr) auto;
}

.price-line input,
.price-line select {
  min-width: 0;
  width: 100%;
}

@media (max-width: 640px) {
  .price-line,
  .discount-line {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }
  .price-line .details,
  .discount-line .label {
    grid-column: 1 / -1;
  }
}

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

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.price-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.price-row .price {
  flex: 0 1 auto;
  max-width: 60%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 2px 6px;
  text-align: right;
}

.price-row .price .discount-chip {
  margin-left: 0;
}

.discount-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  margin-left: 6px;
  padding: 0 8px;
  font-size: 11px;
  vertical-align: 1px;
  background: rgba(201, 162, 39, 0.18);
  border-color: var(--gold-2);
  color: var(--text);
}

.discount-notes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.price-preview {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
}

.price-preview h3 {
  margin-top: 0;
}

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

.price-pick-item {
  justify-content: space-between;
  display: flex;
  gap: 10px;
  text-align: left;
  height: auto;
  padding: 8px 12px;
}

/* How to pay, on an invoice */
.inv-payment {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.status-payment_sent {
  background: rgba(201, 162, 39, 0.2);
}

/* Export formats (Cross Stitch Studio) */
.format-picks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.format-picks .check {
  overflow-wrap: anywhere;
}

/* "Get the Android app" (getapp.js) */
.get-app {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.get-app p {
  margin: 0;
}

.get-app-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.get-app-download {
  justify-content: center;
  text-decoration: none;
}

.get-app-steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

/* ---------------------------------------------------------------- People search, follow lists, profile tabs */

.people-search {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.suggest-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.suggest-wrap input {
  width: 100%;
}

.suggest-list {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  max-height: 340px;
  overflow-y: auto;
}

.suggest-list .person-btn {
  width: 100%;
}

.people-section:not(:empty) {
  margin: 14px 0;
}

.people-head {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.recent-people {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.recent-person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  flex: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font-size: 0.75rem;
}

.recent-person span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-btn {
  cursor: pointer;
  border: 0;
  font: inherit;
}

.follow-request {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.follow-request .item-row {
  flex-wrap: wrap;
}

.follow-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 6px 0 2px;
}

.follow-count {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--purple);
  cursor: pointer;
}

.follow-count strong {
  font-size: 1.3rem;
}

.follow-count:hover:not(:disabled) {
  text-decoration: underline;
}

.follow-count:disabled {
  cursor: default;
  opacity: 0.8;
}

.profile-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
  max-width: 100%;
}

.profile-tabs .seg {
  flex: none;
  white-space: nowrap;
}

.profile-tab-body {
  margin-top: 12px;
}

.profile-posts {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 75vh;
  overflow-y: auto;
}

.service-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.service-line .link-btn {
  padding: 0;
}

.style-full {
  width: 100%;
  border-radius: 10px;
}

.share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.code-input {
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  text-align: center;
}

#auth-forgot {
  align-self: center;
}

.warn-box {
  background: #fff5e0;
  color: #6b4700;
  border-color: #eec66f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .warn-box {
    background: #3a2d10;
    color: #f5d48a;
  }
}

:root[data-theme="dark"] .warn-box {
  background: #3a2d10;
  color: #f5d48a;
}

.profile-extras {
  width: 100%;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.type-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.type-btn:hover {
  border-color: var(--gold-2);
}

.type-btn.new-type {
  border-style: dashed;
  justify-content: center;
}

.type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.measure-line {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.measure-line input {
  min-width: 0;
}

.measure-line input[readonly] {
  border-color: transparent;
  background: none;
  padding-left: 0;
  font-weight: 600;
}

.pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pick-list .person-btn {
  width: 100%;
}

.deal-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid var(--gold-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

#people-search-btn {
  width: auto;
  flex: none;
  padding-inline: 18px;
}

/* The server's copy of a page's text (server/seo.js), for when scripts are off. */
.seo-content {
  padding: 24px 16px;
}
