:root{
  --bg:#eef2f7;
  --card:#ffffff;
  --muted:#6b7280;
  --text:#0f172a;
  --accent:#7c3aed;
  --accent-2:#a78bfa;
  --shadow: 0 10px 30px rgba(16,24,40,.08), 0 4px 10px rgba(16,24,40,.06);
}

*{box-sizing:border-box; margin:0; padding:0;}
html,body{
  height:100%;
  width:100%;
  overflow-x:hidden; /* ✅ جلوگیری از اسکرول افقی */
  background:var(--bg);
  font-family:Inter,ui-sans-serif,system-ui;
  color:var(--text);
}

body{
  display:flex;
  flex-direction:column;
  min-height:100vh;
}

.app{
  display:grid;
  grid-template-columns:220px 1fr;
  min-height:100vh;
  overflow-x:hidden; /* ✅ */
}

.sidebar{
  background:#f6f7fb;
  border-inline-end:1px solid #e5e7eb;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
  overflow-y:auto;
}

.logo{
  width:44px;
  height:44px;
  border-radius:12px;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#fff;
  display:grid;
  place-items:center;
  font-weight:900;
  margin-bottom:4px;
  flex-shrink:0;
}

.nav-btn{
  background:#fff;
  border:1px solid #eceff5;
  border-radius:12px;
  padding:10px 12px;
  text-align:right;
  color:#334155;
  cursor:pointer;
  transition:all .2s ease;
}
.nav-btn:hover{background:#f9fafb}
.nav-btn.active{
  background:linear-gradient(180deg,#fff,#f8faff);
  border-color:#e9ecf5;
  box-shadow:var(--shadow);
}

.spacer{flex:1}

.pill{
  border-radius:999px;
  padding:10px 14px;
  border:none;
  background:linear-gradient(180deg,#fff,#f8faff);
  box-shadow:var(--shadow);
  cursor:pointer;
  font-weight:500;
  transition:all .2s ease;
}
.pill:hover{transform:translateY(-1px)}
.pill.outline{background:transparent;border:1px dashed #cbd5e1}
.pill.tiny{padding:6px 10px;border-radius:999px;font-size:12px}
.pill.danger{background:#fee2e2;color:#7f1d1d;border:1px solid #fecaca}

.mini{
  background:#fff;
  border:1px solid #eceff5;
  border-radius:12px;
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.mini-lbl{font-size:12px;color:#475569}
.mini-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}

.main{
  padding:18px;
  overflow-x:hidden; /* ✅ جلوگیری از اسکرول افقی */
}

.topbar{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  margin-bottom:18px;
  flex-wrap:wrap;
}

.card{
  background:var(--card);
  border-radius:20px;
  padding:18px;
  box-shadow:var(--shadow);
  border:1px solid #ecf0f6;
  overflow:hidden;
}
.soft{background:linear-gradient(180deg,#fff,#fbfdff)}

.brand{font-weight:800;color:#1f2937}

.actions{display:flex;gap:8px;flex-wrap:wrap}

.btn{
  border-radius:12px;
  border:1px solid #e5e7eb;
  background:#fff;
  color:#111827;
  padding:12px 16px;
  cursor:pointer;
  font-weight:500;
  transition:all .2s ease;
}
.btn:hover{background:#f3f4f6}
.btn.primary{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#fff;
  border:none;
}
.btn.primary:hover{opacity:0.9}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(300px,1fr));
  gap:16px;
}
.full{grid-column:1/-1}
.col{display:flex;flex-direction:column;gap:12px}
h3{margin:0 0 8px 0;color:#111827}

.row{display:grid;gap:12px}
.row.two{grid-template-columns:repeat(auto-fit,minmax(250px,1fr))}
.row.three{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
.row.four{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}

.field{display:flex;flex-direction:column;gap:6px}
.field>span{color:#475569;font-size:13px}

input,select{
  border:1px solid #d9e0ea;
  border-radius:12px;
  padding:12px 12px;
  background:#fff;
  color:#0f172a;
  width:100%;
  max-width:100%;
}

.colorfield .color-wrap{
  display:grid;
  grid-template-columns:1fr 52px;
  gap:8px;
}
input[type=color]{
  width:52px;
  height:44px;
  border-radius:12px;
  border:1px solid #d9e0ea;
  padding:0;
  cursor:pointer;
}

.link{margin-top:6px;font-size:12px;color:#6d28d9;text-decoration:none}
.link:hover{text-decoration:underline}

.preview-box{
  width:100%;
  aspect-ratio:3/4;
  border:1px dashed #e5e7eb;
  border-radius:16px;
  background:#fafbff;
  display:grid;
  place-items:center;
  overflow:hidden;
}
.preview-box.tall{aspect-ratio:3/4}

.preview-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
  gap:12px;
  margin-top:8px;
}

.imgbox{
  width:100%;
  aspect-ratio:4/3;
  border-radius:14px;
  overflow:hidden;
  border:1px dashed #e5e7eb;
  background:#f9fbff;
}
.imgbox img,.preview-box img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.code{
  background:#0f172a;
  color:#e2e8f0;
  border-radius:16px;
  padding:14px;
  white-space:pre-wrap;
  max-height:440px;
  overflow:auto;
  border:1px solid #0b1220;
  scrollbar-width:thin;
}

@media (max-width:1100px){
  .grid{grid-template-columns:1fr}
  .sidebar{display:none}
  .app{grid-template-columns:1fr}
}
