/* Block: ui — layout and components. Colours come from the tokens in index.html. */
*, *::before, *::after { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); }
#app {
  max-width: 1040px; margin: 0 auto;
  padding-block: 28px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 20px;
}
.top h1 { font-family: var(--font-head); font-size: 1.9rem; margin: 0 0 4px; letter-spacing: -0.01em; }
.top p { margin: 0; color: var(--muted); max-width: 60ch; line-height: 1.5; }
.grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .grid { grid-template-columns: minmax(0, 1fr); } .previews { order: -1; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel h2 { font-family: var(--font-head); font-size: 1rem; margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.row { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
.lbl { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.field.row .lbl { min-width: 4.5rem; }
input[type="text"], select {
  font: 600 1.05rem var(--font-body); color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; min-width: 0;
}
input[type="text"] { text-transform: uppercase; letter-spacing: 0.02em; }
input[type="color"] { width: 48px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); padding: 2px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.styles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 460px) { .styles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.style {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px;
  background: var(--field); border: 2px solid transparent; border-radius: 12px; cursor: pointer;
  font: 600 0.72rem var(--font-body); color: var(--ink); min-width: 0;
}
.style canvas { width: 100%; max-width: 64px; aspect-ratio: 1; border-radius: 50%; }
.style[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.style span { text-align: center; line-height: 1.2; }

.link { background: none; border: 0; color: var(--accent); font: 600 0.85rem var(--font-body); cursor: pointer; padding: 4px 0; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.primary {
  font: 700 1rem var(--font-body); color: var(--on-accent); background: var(--accent);
  border: 0; border-radius: 12px; padding: 14px 18px; cursor: pointer;
}
.primary:hover { filter: brightness(1.08); }
.status { margin: 0; min-height: 1.3em; font-size: 0.88rem; color: var(--muted); }

/* WhatsApp crop: the circle shows the middle 68% of the picture. */
.crop { position: relative; border-radius: 50%; overflow: hidden; flex: none; }
.crop .crop-img { position: absolute; width: 147%; height: 147%; left: -23.5%; top: -23.5%; }
.crop.big { width: min(260px, 70vw); aspect-ratio: 1; align-self: center; }
.crop.small { width: 49px; height: 49px; }
.wa { display: flex; align-items: center; gap: 14px; background: var(--wa-bg); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.wa-text { min-width: 0; }
.wa-name { color: var(--wa-ink); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-msg { color: var(--wa-muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.full { display: block; width: 100%; max-width: 320px; margin-top: 10px; border-radius: 8px; border: 1px solid var(--line); }
.hint { font-size: 0.82rem; color: var(--muted); margin: 8px 0 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
