:root {
  --bg: #f5f3ee; --card: #ffffff; --text: #1f2328; --muted: #6b6f76;
  --line: #e2ded5; --accent: #0f5c4d; --accent-ink: #ffffff; --danger: #b42318;
  --name: #1d6fd8; --phone: #c2410c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a; --card: #1e2125; --text: #e8e6e3; --muted: #9aa0a6;
    --line: #32363c; --accent: #4fc3a1; --accent-ink: #08231c; --danger: #f97066;
    --name: #6aa8ff; --phone: #ff9a5c;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--card);
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; }
header h1 { font-size: 18px; margin: 0; }
header h1 small { font-weight: 400; color: var(--muted); font-size: 14px; margin-left: 6px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 12px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=tel], input[type=password], select {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; }
input[type=color] { width: 44px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: none; padding: 2px; }
input[type=range] { width: 100%; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row > .shrink { flex: 0 0 auto; }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 10px 14px;
  border-radius: 8px; cursor: pointer; font: inherit; display: inline-block; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.canvas-wrap { background: repeating-conic-gradient(var(--line) 0 25%, transparent 0 50%) 0 0 / 20px 20px;
  border-radius: 8px; overflow: hidden; display: flex; justify-content: center; }
canvas { max-width: 100%; height: auto; display: block; touch-action: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.thumb { border: 2px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer;
  background: var(--card); padding: 0; text-align: left; color: var(--text); font: inherit; }
.thumb[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.thumb img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: var(--bg); }
.thumb span { display: block; padding: 6px 8px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); margin: 10px 0 0; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; }
.toast.show { opacity: 1; }
[hidden] { display: none !important; }
