:root {
  --paper: #f3efe6;
  --ink: #1c1917;
  --red: #9f1239;
  --card: #fffdf8;
  --line: #e7e0d4;
  --muted: #78716c;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Khatmi", "Cairo", "Noto Naskh Arabic", Tahoma, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: #1c1917; color: #faf7f2;
}
.brand { font-weight: 800; font-size: 22px; }
.brand span { color: #fb7185; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav button, .btn {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  padding: 8px 12px; border-radius: 999px;
}
.btn.solid, .nav button.on { background: var(--red); color: white; }
.btn.ghost { background: white; border: 1px solid var(--line); color: var(--ink); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 18px 60px; }
.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 28px; align-items: center; }
.hero h1 { font-size: 42px; line-height: 1.35; margin: 0 0 10px; }
.hero p { color: #44403c; font-size: 18px; line-height: 1.8; }
.seal-preview {
  width: 280px; height: 280px; margin: auto; border-radius: 50%;
  border: 10px solid var(--red); display: grid; place-items: center;
  color: var(--red); background: white; box-shadow: 0 20px 50px #0001;
}
.seal-preview b { font-size: 28px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.card, .tpl {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
}
.tpl { cursor: pointer; text-align: center; }
.tpl:hover, .tpl.on { border-color: var(--red); }
.tpl small { color: var(--muted); }
.tpl div { font-size: 12px; color: var(--muted); margin-top: 4px; }
.studio { display: grid; grid-template-columns: 250px 1fr 280px; gap: 14px; }
.stage {
  background:
    linear-gradient(45deg, #ece7df 25%, transparent 25%),
    linear-gradient(-45deg, #ece7df 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ece7df 75%),
    linear-gradient(-45deg, transparent 75%, #ece7df 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-color: #f7f4ee;
  border-radius: 18px; display: grid; place-items: center; min-height: 640px;
}
canvas { width: min(560px, 100%); height: auto; background: transparent; touch-action: none; }
#tpls canvas { width: 130px; height: 130px; background: #f6f3ec; border-radius: 10px; }
#home-grid canvas { width: 120px; height: 120px; background: #f6f3ec; border-radius: 10px; }
#tpls .tpl, #home-grid .tpl { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.controls { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
input[type="range"] { width: 100%; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="color"], select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: white;
}
.row { display: flex; gap: 8px; margin-top: 12px; }
.row .btn { flex: 1; }
.auth { max-width: 420px; margin: 30px auto; }
.list { display: grid; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; }
.item img { width: 72px; height: 72px; object-fit: contain; background: #f6f3ec; border-radius: 10px; }
.msg { color: var(--red); min-height: 1.2em; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { text-align: right; padding: 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
@media (max-width: 980px) {
  .hero, .studio { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .stage { min-height: 420px; }
}
